Hi List
When using Spork, I am having some issues working with content types. I am trying to do this:
(define mono-serv (spork-serve root: "/spork" ))
(add-spork mono-serv ("main.css" doctype: "text/css" mime: "text/css" headers: '(("Content-Type" . "text/css") ("foo" . "bar"))) main-css)
I always get a content type of "text/html; Charset=UTF-8", and the second foo/bar header isn't shown.
I suspect that it is just a syntax issue on my side, but I am not sure what the correct syntax is.
Thanks!
Afficher les réponses par date
Hi,
First of all, just a warning, I have no time to maintain Spork at the moment. I struggle to find time fixing bugs in blackhole. The API for Spork is definitely still not yet polished. Spork embodies a couple of imo really cool concepts which would in theory be fantastic in a real web framework, but that's about where it is right now..
To your question: The API for this is not very well developed, but it is there. I think that you have to use show to be able to specify these options, like this
(add-spork mono-serv ("main.css") (show (lambda (_) main-css) [here goes keyword arguments to the show function]))
The doctype: isn't really what you want to do, it is a somewhat hacky way to enable the user to specify, when returning SXML, whether it should be serialized to XML or HTML and which version. When the show thunk returns a string, doctype: is bypassed.
It should be sufficient to just set the mime:.
Also, you might be interested in checking out file.scm in the Spork source, it does a related thing. It is used like
(cutlery-add-spork! mono-serv (file-spork "contents" path: "static/"))
To make http://host/static/hello.css serve contents/hello.css.
/Per
17 okt 2009 kl. 08.27 skrev Jonathan Arkell:
Hi List
When using Spork, I am having some issues working with content types. I am trying to do this:
(define mono-serv (spork-serve root: "/spork" ))
(add-spork mono-serv ("main.css" doctype: "text/css" mime: "text/css" headers: '(("Content-Type" . "text/css") ("foo" . "bar"))) main-css)
I always get a content type of "text/html; Charset=UTF-8", and the second foo/bar header isn't shown.
I suspect that it is just a syntax issue on my side, but I am not sure what the correct syntax is.
Thanks! _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list