http_jmap: error=Unable to parse JSON request body

Sayid Munawar sayid.munawar at gmail.com
Fri Mar 18 09:58:25 EDT 2016


Hi,

I am just trying out the new and shiny JMAP implementation using
cyrus-imapd master. But when i made the request using postman (chrome app).
It gave me error:

Mar 18 20:16:33 gaby http[2543]: ipv4-x-x-x.as55666.net [111.x.x.x] as
"diaz" with "Mozilla/5.0 (Chrome/49.0.2623.87 Safari/537.36"; "POST
/jmap/authentication HTTP/1.1"
(origin=chrome-extension://aicmkgpgakddgnaphhhpliifpcfhicfo) => "400 Bad
Request" (error=Unable to parse JSON request body#015#012)

And when i change the code in http_jmap.c to output the RAW json: it
displayed:

Mar 18 19:15:41 gaby http[28360]: JSON {#012#011"username":
"diaz at localhost",#012#011"clientName":
"CLIENT",#012#011"clientVersion": "0.1",#012#011"deviceName": "api"#012}

I don't know how the "#012#11" characters came from, it should have been "{"


But when using cURL, the RAW json data is correct:

Mar 18 19:19:10 gaby http[28616]: JSON {    "username": "diaz at localhost",
  "clientName": "CLIENT",    "clientVersion": "0.1",    "deviceName": "api"}

but still give error "400 Bad Request"

Then i upgrade jansson to 2.7.3, but the error persist.

Then i compare the json_loads implementation from http_jmap.c and jcal.c,
and then remove the `json_is_array` condition, so it looked like:

    req = json_loads(buf_cstring(&txn->req_body.payload), 0, &jerr);
    if (!req) {

Now i get HTTP 200 OK.  But i got empty JSON reply "[]" where it should
have been "continuationToken" if i read the from jmap.io spec.


Any clue how to get the "continuationToken" from the server ?


Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20160318/11f09a35/attachment.html>


More information about the Cyrus-devel mailing list