<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
<br>
Using Racket 6.0.1 response/output is throwing an error when I
use the #:cookies keyword:<br>
<br>
<tt>application: procedure does not expect an argument with given
keyword</tt><tt><br>
</tt><tt> procedure: response/output</tt><tt><br>
</tt><tt> given keyword: #:cookies</tt><tt><br>
</tt><tt> arguments...:</tt><tt><br>
</tt><tt> #<procedure:temp1></tt><tt><br>
</tt><tt> #:code 200</tt><tt><br>
</tt><tt> #:cookies '()</tt><tt><br>
</tt><tt> #:message #"OK"</tt><tt><br>
</tt><tt> #:mime-type #"application/javascript"</tt><tt><br>
</tt><tt> #:seconds 141522071</tt><br>
<br>
Code is: <br>
<br>
<tt>(define (response/json obj . cookies )</tt><tt><br>
</tt><tt> (response/output</tt><tt><br>
</tt><tt> (λ (op) (write-json obj op))</tt><tt><br>
</tt><tt> #:code 200</tt><tt><br>
</tt><tt> #:message #"OK"</tt><tt><br>
</tt><tt> #:seconds (current-seconds)</tt><tt><br>
</tt><tt> #:mime-type #"application/javascript"</tt><tt><br>
</tt><tt> #:cookies cookies</tt><tt><br>
</tt><tt> ))</tt><tt><br>
</tt><br>
I get the same error with and without a list of cookies. However,
it works if I change the code to use <br>
<br>
<tt> </tt><tt>#:headers (map cookie->header cookies)</tt><br>
<br>
<br>
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:<br>
<br>
<table class="boxed RBoxed" bgcolor="#ffffcc" border="0"
cellspacing="0">
<tbody>
<tr>
<td>
<blockquote class="SubFlow">
<table class="prototype RForeground" cellspacing="0">
<tbody>
<tr>
<td><span class="RktPn">(</span><span
title="Provided from:
web-server/http/response-structs | Package:
web-server-lib"><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.2&filename=http.html"
class="RktValDef RktValLink" data-pltdoc="x">response/output</a></span></span></td>
<td><span class="hspace"> </span></td>
<td><span class="RktVar">output</span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
</tr>
<tr>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span>[</td>
<td><span class="RktPn">#:code</span><span
class="hspace"> </span><span class="RktVar">code</span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
</tr>
<tr>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="RktPn">#:message</span><span
class="hspace"> </span><span class="RktVar">message</span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
</tr>
<tr>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="RktPn">#:seconds</span><span
class="hspace"> </span><span class="RktVar">seconds</span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
</tr>
<tr>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="RktPn">#:mime-type</span><span
class="hspace"> </span><span class="RktVar">mime-type</span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
</tr>
<tr>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="RktPn">#:headers</span><span
class="hspace"> </span><span class="RktVar">headers</span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
</tr>
<tr>
<td><span class="hspace"> </span></td>
<td><span class="hspace"> </span></td>
<td><span class="RktPn">#:cookies</span><span
class="hspace"> </span><span class="RktVar">cookies</span>]<span
class="RktPn">)</span></td>
<td><span class="hspace"> </span></td>
<td>→</td>
<td><span class="hspace"> </span></td>
<td><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.3&filename=http.html"
class="RktValLink" data-pltdoc="x">response?</a></span></td>
</tr>
</tbody>
</table>
</blockquote>
</td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">output</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktPn">(</span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.4&filename=function-contracts.html"
class="RktStxLink Sq" data-pltdoc="x"><span
class="nobreak">-></span></a></span><span
class="hspace"> </span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.5&filename=port-ops.html"
class="RktValLink Sq" data-pltdoc="x">output-port?</a></span><span
class="hspace"> </span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.6&filename=void.html"
class="RktValLink Sq" data-pltdoc="x">void?</a></span><span
class="RktPn">)</span></td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">code</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.7&filename=number-types.html"
class="RktValLink Sq" data-pltdoc="x">number?</a></span><span
class="hspace"> </span>=<span class="hspace"> </span><span
class="RktVal">200</span></td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">message</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.8&filename=bytestrings.html"
class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span
class="hspace"> </span>=<span class="hspace"> </span><span
class="RktVal">#"Okay"</span></td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">seconds</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.7&filename=number-types.html"
class="RktValLink Sq" data-pltdoc="x">number?</a></span><span
class="hspace"> </span>=<span class="hspace"> </span><span
class="RktPn">(</span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.9&filename=time.html"
class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span
class="RktPn">)</span></td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">mime-type</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktPn">(</span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.10&filename=data-structure-contracts.html"
class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span
class="hspace"> </span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.8&filename=bytestrings.html"
class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span
class="hspace"> </span><span class="RktVal">#f</span><span
class="RktPn">)</span><span class="hspace"> </span>=<span
class="hspace"> </span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.11&filename=http.html"
class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">headers</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktPn">(</span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.12&filename=data-structure-contracts.html"
class="RktValLink Sq" data-pltdoc="x">listof</a></span><span
class="hspace"> </span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.13&filename=http.html"
class="RktValLink" data-pltdoc="x">header?</a></span><span
class="RktPn">)</span><span class="hspace"> </span>=<span
class="hspace"> </span><span class="RktVal">'</span><span
class="RktVal">(</span><span class="RktVal">)</span></td>
</tr>
<tr>
<td><span class="hspace"> </span><span class="RktVar">cookies</span><span
class="hspace"> </span>:<span class="hspace"> </span><span
class="RktPn">(</span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.12&filename=data-structure-contracts.html"
class="RktValLink Sq" data-pltdoc="x">listof</a></span><span
class="hspace"> </span><span class="RktSym"><a
href="mailbox:///C:/Users/GW/Documents/Eudora/GW/Mail/Local%20Folders/Drafts?number=5706892&part=1.14&filename=cookie.html"
class="RktValLink Sq" data-pltdoc="x">cookie?</a></span><span
class="RktPn">)</span><span class="hspace"> </span>=<span
class="hspace"> </span><span class="RktVal">'</span><span
class="RktVal">(</span><span class="RktVal">)</span></td>
</tr>
</tbody>
</table>
<br>
<br>
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 ?<br>
<br>
Thanks,<br>
George<br>
<br>
</body>
</html>