I would guess that your request's body is not properly formatted and the webserver rejects the request.
I would guess that your request's body is not properly formatted and the webserver rejects the request.
You do not need to set the Content-Length header yourself, Qt will do that when you call post().
Are you sure that the server is expecting the key in the query string and raw JSON data in the post body and not:
- A URL encoded body with multiple parameters encoded (application/x-www-form-urlencoded), or
- A multipart/form-data payload?
Are you sure the server is expecting application/json as the content type and not one of the other, non-standard types used for JSON?
Is the JSON string UTF8 encoded?
Without seeing any error information or server logs we can only guess.
Thanks for the replies. The server was expecting form data.
Have now fixed this to send multipart/form-data and it's working a dream!
Many Thanks,
Richard
Last edited by Poonarge; 21st August 2014 at 13:57.
Bookmarks