How To Debug XHR POST Requests In Safari 4?
Solution 1:
If 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.)
Solution 2:
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):
Post a Comment for "How To Debug XHR POST Requests In Safari 4?"