[racket] response/output #:cookies keyword ???
Sorry. This is a typo that has always been part of the response/output
documentation:
https://github.com/plt/racket/commit/944602440c4e44cec8a4a6662336989fe37b29e7
My guess is that it was copied from response/xexpr. I'll update the docs.
Sorry for the inconvenience.
Jay
On Wed, Nov 5, 2014 at 4:56 PM, George Neuner <gneuner2 at comcast.net> wrote:
> Hi all,
>
> Using Racket 6.0.1 response/output is throwing an error when I use the
> #:cookies keyword:
>
> application: procedure does not expect an argument with given keyword
> procedure: response/output
> given keyword: #:cookies
> arguments...:
> #<procedure:temp1>
> #:code 200
> #:cookies '()
> #:message #"OK"
> #:mime-type #"application/javascript"
> #:seconds 141522071
>
> Code is:
>
> (define (response/json obj . cookies )
> (response/output
> (λ (op) (write-json obj op))
> #:code 200
> #:message #"OK"
> #:seconds (current-seconds)
> #:mime-type #"application/javascript"
> #:cookies cookies
> ))
>
> I get the same error with and without a list of cookies. However, it
> works if I change the code to use
>
> #:headers (map cookie->header cookies)
>
>
> The 6.0.1 documentation (hope the cut-n-paste renders!) indicates that
> #:cookies is a valid keyword. I checked the online docs for 6.1.1 and
> they still say the same:
>
> (response/output output [ #:code code
> #:message message #:seconds seconds #:mime-type
> mime-type #:headers headers #:cookies cookies])
> → response?
>
> output : (-> output-port? void?) code : number? = 200 message :
> bytes? = #"Okay" seconds : number? = (current-seconds) mime-type : (
> or/c bytes? #f) = TEXT/HTML-MIME-TYPE headers : (listof header?) = '()
> cookies : (listof cookie?) = '()
>
> I know that cookies are placed using headers and that there is no separate
> field in the actual response, but seeing this I expected that the function
> would create the appropriate header(s) for me. Obviously (map
> cookie->header ...) is an easy work-around, but I'd like to know if this is
> a documentation error or if I really was doing something wrong. Or
> possibly prematurely - is #:cookies implemented in 6.1.x ?
>
> Thanks,
> George
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
--
Jay McCarthy
http://jeapostrophe.github.io
"Wherefore, be not weary in well-doing,
for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
- D&C 64:33
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141105/92ea318a/attachment.html>