admin管理员组文章数量:1291004
I've got an XHR request that's succeeding in FF3.5 but apparently failing when done in Safari 4. I'm looking at the xhr requests in the debugger in Safari, and Firebug in Firefox.
So on the backend service that's being hit, if the username and password are missing from the POST parameter then the service gives a 500 error. If the parameters are there(even if incorrect), it gives 200 or 40x depending on the error.
Anyway, so with the same code its working for the non-Safari browsers. Safari gets the 500 error like the user/pass aren't being passed through.
As I'm examining the requests in the debugger, it doesn't look like it shows POST data in the logs.
Is there an option I need to enable, or just how do you debug these requests in Safari 4?
I've got an XHR request that's succeeding in FF3.5 but apparently failing when done in Safari 4. I'm looking at the xhr requests in the debugger in Safari, and Firebug in Firefox.
So on the backend service that's being hit, if the username and password are missing from the POST parameter then the service gives a 500 error. If the parameters are there(even if incorrect), it gives 200 or 40x depending on the error.
Anyway, so with the same code its working for the non-Safari browsers. Safari gets the 500 error like the user/pass aren't being passed through.
As I'm examining the requests in the debugger, it doesn't look like it shows POST data in the logs.
Is there an option I need to enable, or just how do you debug these requests in Safari 4?
Share Improve this question asked Aug 26, 2009 at 22:31 GeuisGeuis 42.3k57 gold badges163 silver badges223 bronze badges 2-
Do you have any content in the response body? Even a
" "
space? – Crescent Fresh Commented Aug 26, 2009 at 23:29 - Can you paste the relevant code? – kangax Commented Aug 27, 2009 at 2:43
2 Answers
Reset to default 5If you are referring to the Safari "Web Inspector": it indeed does not show the POST data when sent using Ajax. I'd use a packet sniffer like Wireshark (but just because I also use it for other things), or a debugging proxy.
Some things to check with your POST: are you invoking setRequestHeader
to set the required HTTP headers, like Connection
, Content-Type
and Content-Length
? And as your code works with Firefox, I assume you are actually setting the POST content using send
? Post your code in JS Bin please!
(Just for the archives: apart from enabling the debug menu through defaults.write
, Safari 4 also has a Develop menu that you can simply enable through the advanced preferences. Choose "Show Web Inspector ⌥⌘I" and you should be able to see the requests and responses on the Resources tab. Ensure to select "Sort by Start Time". If the XHR is sent through GET, one obviously has to look at the request URL itself, which is shown fine. However, for POST, the request headers are shown, but the POST data is sadly missing. I've never used the debug menu though.)
As of today (Safari 7.1) the POST request data is present in the right sidebar if you select such an XHR (in an XHRs folder under the Resources tab):
本文标签: javascriptHow to debug XHR POST requests in Safari 4Stack Overflow
版权声明:本文标题:javascript - How to debug XHR POST requests in Safari 4? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741521294a2383200.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论