With my first server call of a session, the responseHeaders dictionary will be null which throws an exception:
NullReferenceException: Object reference not set to an instance of an object
Similar to this:
However, I was not seeing this issue with 2017.1.1p3. Also, by running through Charles Proxy I can see all of the responseHeaders and the rest of the data. If I catch and ignore this NullReferenceException, I can continue to get all of the data except for the missing response headers.
Anyone else seeing this issue, or know of a workaround? The Android prefab load times finally seem to be fixed in 2017.2 and I need to be able to update to this version.
Michael
This bug will be fixed soon. responseHeaders are null when they are not yet available (i.e. not yet received or request has failed). For now you have to explicitly check for null.
In our situation, the responseHeaders should be available (I can see them in Charles Proxy and the request did not fail). We also rely on the data in the headers, so we can’t just null check and ignore the fact that they are not there.
Is request completed and successful?
I’m also aware of (seemingly) android specific issue about headers being unavailable when chunked transfer is used, but that hasn’t been confirmed yet. Is any of this similar to your case?
Yes, the request is completed and successful.
If I catch the null exception and continue, I am able to see the contents of the response body, just not the headers.
We are not explicitly setting the chunkedTransfer parameter.
I am seeing this on Android, but I have not verified whether it happens on iOS yet or not. It does not happen through the editor.
Using Charles Proxy I get the following stats about the response:
Response 4.23 KB
TLS Handshake -
Header 168 bytes
Cookies -
Body 4.07 KB
Uncompressed Body 10.49 KB
Compression 61.2% (gzip)