| From: George Neuner (gneuner2 at comcast.net) Date: Wed Nov 5 16:56:17 EST 2014 |
|
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
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.2&filename=http.html>
output
[ #:codecode
#:messagemessage
#:secondsseconds
#:mime-typemime-type
#:headersheaders
#:cookiescookies]) → response?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.3&filename=http.html>
output:(->
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.4&filename=function-contracts.html>output-port?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.5&filename=port-ops.html>void?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.6&filename=void.html>)
code:number?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.7&filename=number-types.html>=200
message:bytes?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.8&filename=bytestrings.html>=#"Okay"
seconds:number?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.7&filename=number-types.html>=(current-seconds
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.9&filename=time.html>)
mime-type:(or/c
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.10&filename=data-structure-contracts.html>bytes?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.8&filename=bytestrings.html>#f)=TEXT/HTML-MIME-TYPE
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.11&filename=http.html>
headers:(listof
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.12&filename=data-structure-contracts.html>header?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.13&filename=http.html>)='()
cookies:(listof
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.12&filename=data-structure-contracts.html>cookie?
<mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.14&filename=cookie.html>)='()
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141105/ed952edd/attachment-0001.html>
| Posted on the users mailing list. |
|