edicl / drakma

HTTP client written in Common Lisp
http://edicl.github.io/drakma/
249 stars 58 forks source link

Need to be able to set :content-type when using :method :post #113

Closed copecog closed 3 years ago

copecog commented 3 years ago

I'm POST'ing XML requests to an API that needs the Content-Type to be "application/xml" or "text/xml" and it appears that Drakma doesn't do anything with :content-type when POST'ing.

phoe commented 3 years ago

Cannot reproduce. Using drakma from Quicklisp "2021-01-24", nc -vvv -l -p 8080 as a server, and the following Drakma call:

CL-USER> (drakma:http-request "http://localhost:8080/"
                              :method :post
                              :content-type "application/lisp" 
                              :content "(foo bar baz)")

I see the following in netcat output:

listening on [any] 8080 ...
connect to [127.0.0.1] from localhost [127.0.0.1] 57924
POST / HTTP/1.1
Host: localhost:8080
User-Agent: Drakma/2.0.7 (SBCL 2.1.3; Linux; 5.10.0-1-amd64; http://weitz.de/drakma/)
Accept: */*
Connection: close
Content-Type: application/lisp
Content-Length: 13

(foo bar baz)

In particular, Content-Type: application/lisp is set correctly for me.

copecog commented 3 years ago

The user is a bit slow - I know him well, we can close this.