Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Set Content-Length header for UnityWebRequest POST requests in 2017.3?

$
0
0
I am trying to send multipart form data via a `UnityWebRequest` to a REST service. The request is built with the following code: public IEnumerator Post(string uri, WWWForm data, Action onFinished = null) { Request = UnityWebRequest.Post(uri, data); yield return sendRequest(); if (onFinished != null) onFinished(Request, UploadException); } (This is missing some context from the rest of the class, but the important part is the `UniytWebRequest.Post(uri, data);` line). In previous versions of Unity this has worked fine, but in 2017.3, the remote server has started returning a 411 Length Required error. Looking at the request object before it is sent, I see that the Content-Type header is set, but no Content-Length header is present. I attempted to set the header manually, but got the following error: `InvalidOperationException: Cannot override system-specified headers` Is there another way to set the outgoing content length header in 2017.3?

Viewing all articles
Browse latest Browse all 387

Trending Articles