<div dir="ltr">Sorry. This is a typo that has always been part of the response/output documentation:<div><br></div><div><a href="https://github.com/plt/racket/commit/944602440c4e44cec8a4a6662336989fe37b29e7">https://github.com/plt/racket/commit/944602440c4e44cec8a4a6662336989fe37b29e7</a><br></div><div><br></div><div>My guess is that it was copied from response/xexpr. I'll update the docs.</div><div><br></div><div>Sorry for the inconvenience.</div><div><br></div><div>Jay</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 5, 2014 at 4:56 PM, George Neuner <span dir="ltr"><<a href="mailto:gneuner2@comcast.net" target="_blank">gneuner2@comcast.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div 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 bgcolor="#ffffcc" border="0" cellspacing="0">
      <tbody>
        <tr>
          <td>
            <blockquote>
              <table cellspacing="0">
                <tbody>
                  <tr>
                    <td><span>(</span><span title="Provided from:
                        web-server/http/response-structs | Package:
                        web-server-lib"><span><a>response/output</a></span></span></td>
                    <td><span> </span></td>
                    <td><span>output</span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                  </tr>
                  <tr>
                    <td><span> </span></td>
                    <td><span> </span>[</td>
                    <td><span>#:code</span><span> </span><span>code</span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                  </tr>
                  <tr>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span>#:message</span><span> </span><span>message</span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                  </tr>
                  <tr>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span>#:seconds</span><span> </span><span>seconds</span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                  </tr>
                  <tr>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span>#:mime-type</span><span> </span><span>mime-type</span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                  </tr>
                  <tr>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span>#:headers</span><span> </span><span>headers</span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span> </span></td>
                  </tr>
                  <tr>
                    <td><span> </span></td>
                    <td><span> </span></td>
                    <td><span>#:cookies</span><span> </span><span>cookies</span>]<span>)</span></td>
                    <td><span> </span></td>
                    <td>→</td>
                    <td><span> </span></td>
                    <td><span><a>response?</a></span></td>
                  </tr>
                </tbody>
              </table>
            </blockquote>
          </td>
        </tr>
        <tr>
          <td><span>  </span><span>output</span><span> </span>:<span> </span><span>(</span><span><a><span>-></span></a></span><span> </span><span><a>output-port?</a></span><span> </span><span><a>void?</a></span><span>)</span></td>
        </tr>
        <tr>
          <td><span>  </span><span>code</span><span> </span>:<span> </span><span><a>number?</a></span><span> </span>=<span> </span><span>200</span></td>
        </tr>
        <tr>
          <td><span>  </span><span>message</span><span> </span>:<span> </span><span><a>bytes?</a></span><span> </span>=<span> </span><span>#"Okay"</span></td>
        </tr>
        <tr>
          <td><span>  </span><span>seconds</span><span> </span>:<span> </span><span><a>number?</a></span><span> </span>=<span> </span><span>(</span><span><a>current-seconds</a></span><span>)</span></td>
        </tr>
        <tr>
          <td><span>  </span><span>mime-type</span><span> </span>:<span> </span><span>(</span><span><a>or/c</a></span><span> </span><span><a>bytes?</a></span><span> </span><span>#f</span><span>)</span><span> </span>=<span> </span><span><a>TEXT/HTML-MIME-TYPE</a></span></td>
        </tr>
        <tr>
          <td><span>  </span><span>headers</span><span> </span>:<span> </span><span>(</span><span><a>listof</a></span><span> </span><span><a>header?</a></span><span>)</span><span> </span>=<span> </span><span>'</span><span>(</span><span>)</span></td>
        </tr>
        <tr>
          <td><span>  </span><span>cookies</span><span> </span>:<span> </span><span>(</span><span><a>listof</a></span><span> </span><span><a>cookie?</a></span><span>)</span><span> </span>=<span> </span><span>'</span><span>(</span><span>)</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>
  </div>

<br>____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Jay McCarthy<br><a href="http://jeapostrophe.github.io" target="_blank">http://jeapostrophe.github.io</a><br><br>           "Wherefore, be not weary in well-doing,<br>      for ye are laying the foundation of a great work.<br>And out of small things proceedeth that which is great."<br>                          - D&C 64:33</div>
</div>