Hi, just some quick shots into the dark ...
On Tue, 2007-09-18 at 13:23 +0200, Nicolas Lamirault wrote:
hi, i've got this request :
$> curl --data '{"author":"nicolas"}' http://localhost:8888/test -H "application/json" {"ok":true,"_id":"C97DCFBF09D32461D60F0D30BF3E807C","_rev":555997582}%
Is this _really_ the command line you use? Shouldn't this read
... -H 'Content-Type: application/json" ... ?
I guess you server implementation isn't too picky/stable/wel--programmed and blindly reads the request data anyway :-/
i would like to make the same request using Drakma :
CL-USER> (drakma:http-request "http://localhost:8888/test" :method :post :form-data t :external-format-out :UTF-8 :parameters '(("author" . "nicolas")))
But this will send the request data formated as multipart/form-data and of course the toy-parser will hickup un that. What do you expect?
HTH RalfD
(hoping Edi's server will accept my mail ...)
POST /test HTTP/1.1 Host: localhost:8888 User-Agent: Drakma/0.9.1 (SBCL 1.0; Linux; 2.6.15-23-686; http://weitz.de/drakma/) Accept: */* Connection: close Content-Type: multipart/form-data; boundary=----------sUTYSe7i1UX7ONyEB68U4BbXyx2TZYZ0x1Qmx4vCVWyI9Bpb92 Content-Length: 188
HTTP/1.1 500 Internal Server Error Server: inets/develop Date: Tue, 18 Sep 2007 10:54:03 GMT Cache-Control: no-cache Pragma: no-cache Expires: Tue, 18 Sep 2007 10:54:03 GMT Damien: awesome Content-Type: text/plain; charset=utf-8 Transfer-Encoding: chunked Connection:close
"{"error":{"id":"EXIT","reason":"{function_clause,[{cjson,tokenize_number,[[45,45,45,45,45,45,45,45,45,45,45,115,85,84,89,83,101,55,105,49,85,88,55,79,78,121,69,66,54,56,85,52,66,98,88,121,120,50,84,90,89,90,48,120,49,81,109,120,52,118,67,86,87,121,73,57,66,112,98,57,50,13,10,67,111,110,116,101,110,116,45,68,105,115,112,111,115,105,116,105,111,110,58,32,102,111,114,109,45,100,97,116,97,59,32,110,97,109,101,61,34,97,117,116,104,111,114,34,13,10,13,10,110,105,99,111,108,97,115,13,10,45,45,45,45,45,45,45,45,45,45,45,45,115,85,84,89,83,101,55,105,49,85,88,55,79,78,121,69,66,54,56,85,52,66,98,88,121,120,50,84,90,89,90,48,120,49,81,109,120,52,118,67,86,87,121,73,57,66,112,98,57,50,45,45,13,10],int,{decoder,utf8,null,1,2,any},[45]]},{cjson,tokenize,2},{cjson,decode1,2},{cjson,json_decode,2},{mod_couch,handle_db_request,3},{mod_couch,do,1},{httpd_response,traverse_modules,2},{httpd_response,generate_and_send_response,1}]}"}}" 500 ((:SERVER . "inets/develop") (:DATE . "Tue, 18 Sep 2007 10:54:03 GMT") (:CACHE-CONTROL . "no-cache") (:PRAGMA . "no-cache") (:EXPIRES . "Tue, 18 Sep 2007 10:54:03 GMT") (:DAMIEN . "awesome") (:CONTENT-TYPE . "text/plain; charset=utf-8") (:TRANSFER-ENCODING . "chunked") (:CONNECTION . "close")) #<PURI:URI http://localhost:8888/test%3E #<FLEXI-STREAMS:FLEXI-IO-STREAM {BFB70A1}> T "Internal Server Error"
i've got an error code 500. Due to a bad request i think. Someon knows what error i did in this request ?
thanks.