Have found that this is a known problem. the ie httpwebrequest does not contain a 'Date' header so this can never be set. In order to do this, I have had to make a WP plugin to use the recently added mobile-httpclient code, which can set the 'Date' header.
XHR Date header not being applied in WindowsPhone 8 request
-
24-06-2022 - |
문제
I am communicating with a third party service via XHR (cannot use ajax as I need to send as ArrayBuffer). I had a bunch of problems getting this to work under WP8 but have finally gotten a connection (always worked fine under android and iOS (phonegap)). The problem I have is that I need to send through a couple of specific headers for authentication. I am sending this through as:
xhr.open("POST", url, true);
xhr.timeout = 30000;
xhr.setRequestHeader("Content-Type",contentType+"; boundary=" + boundary);
xhr.setRequestHeader("Accept","application/json; charset=utf-8");
xhr.setRequestHeader("Authorization",auth);
xhr.setRequestHeader("Date",todayString);
xhr.send(bodyBuf);
In essence this works fine other than: the 'Date' header is never received. I constantly get back a response of 'Date header required'. I know that the actual connection is not something that you will be able to advise on, however I am wondering if anyone has encountered this before? Is everyone else able to set the xhr 'Date' header in WP8 which would imply that something is different in my code/setup or if anyone has any ideas.
btw, I am getting the same result when testing through the emulator and via an HTC it is not specific to a single device. but to the WP8 platform
Thanks,
해결책