[SOLVED] content-type missing in HTTP POST, defaulting to application/octet-stream
Just upgraded QT to latest version 4.8.1 libraries on Linux Ubuntu box 10.04 from version 4.7.X.
With the new version I am receiving an error from our server.
QT provides the following warning message:
- content-type missing in HTTP POST, defaulting to application/octet-stream
Our server wont accept the posted data. This ran fine with previous release.
I am aware that the default ContentTypeHeader type needs to be explicitly set under version 4.8.
However even when adding in the setHeader code shown below, I still receive the same error.
Any ideas? Do I also need to set the contentHeader length field too or is this handled automatically.
- QNetworkRequest request;
- QUrl params;
- params.addQueryItem("version","1.0");
- params.addQueryItem("siteid","12345");
- params.addQueryItem("recordid","12345");
- request.setUrl(serverUrl);
- request.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/x-www-form-urlencoded"));
- //request.setHeader(QNetworkRequest::ContentLengthHeader,params.encodedQuery().length());
3 replies
You must log in to post a reply. Not a member yet? Register here!

