On 2023-08-09 10:18:05 -0400, Mortimer Cladwell wrote: > Hi, > I am running a local fake Urbit zod on port 8080. I want to submit an > http-request and obtain an urbauth id cookie. I run the following method: > > (use-modules (web client)(web response) (srfi srfi-9)(oop goops) (ice-9 > receive) (ice-9 pretty-print)) > > (define (urbit-http-connect) > (let* ((uri "http://localhost:8080/~/login") > (data (string-append "password=" "lidlut-tabwed-pillex-ridrup")) > (a (receive (response body) > (http-request uri #:method 'POST #:body data) > response))) > (pretty-print a))) > > ==> #< version: (1 . 1) code: 204 reason-phrase: "ok" headers: > ((date . # 8 year: 2023 zone-offset: 0>) (connection close) (server . > "urbit/vere-2.11") (set-cookie . > "urbauth-~zod=0v7.126dd.8rbvk.lga05.jvieb.287to; Path=/; Max-Age=604800")) > port: #> > > Below I substitute (pretty-print a) with various commands and show the > response: > > (pretty-print (class-of a)) ==> #< <> 7f721fc4c280> > (pretty-print (record? a)) ==> #t > (pretty-print (response? a)) ==> #f > > (pretty-print (response-headers a)) ==> In procedure response-headers: > Wrong type argument: #< version: (1 . 1) code: 204 reason-phrase: > "ok" headers: ((date . # day: 9 month: 8 year: 2023 zone-offset: 0>) (connection close) (server . > "urbit/vere-2.11") (set-cookie . > "urbauth-~zod=0v5.9pm4c.pa0qd.00hao.vsq1p.h37hh; Path=/; Max-Age=604800")) > port: #> > > So I have a record that looks like a record but isn't. How do I > extract the headers from this 'response'? > How do I determine the record type? You are using the (receive) in a wrong way I believe. The value you named body holds the, well, body, but you are just throwing it away. Try something like this, it will print both the response and the body: (use-modules (ice-9 receive) (web client)) (define (urbit-http-connect) (let* ((uri "http://example.org") (data (string-append "password=" "lidlut-tabwed-pillex-ridrup"))) (receive (response body) (http-request uri #:method 'POST #:body data) (format #t "~s~%~s~%" response body)))) (urbit-http-connect) > Thanks > Mortimer W. -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.