62

I am using Chrome 15 with Developer Tools to investigate HTTP POST requests. After sending a request, in the Network tab under Headers there is a section called Form Data. This section contains the post data nicely formatted. However: How do I get the source of the post data, i.e. the body of the request?

Currently, I use Firefox with Firebug to get that data, or I reconstruct the source from the formatted Form Data. Cumbersome...

2

2 Answers 2

90

Chrome 29–56, and possibly beyond

Finally (maybe already with version 28), it's simple. Just click on view source next to Form Data:

DevTools screen shot

Also, at least in version 56, post data may be found in the Headers tab, under Request Payload.

Older versions

  • Chrome 27

    1. Right click in the Name/Path panel in the Network tab.

    2. Select: Copy all as HAR

    3. In the Console, write har=, then paste the HAR, and hit return.

    4. Count from the top the position of the request you are interested, starting at 0. Store the position in: pos

    5. To get the post data source, execute: har.log.entries[pos].request.postData.text

  • even older:

    1. Right click on the Name/Path of the entry in the Network tab.

    2. Select: Copy entry as HAR

    3. In the Console, write har=, then paste the HAR, and hit return.

    4. To get the post data source, execute: har.request.postData.text

If there is a simpler way, I am happy to hear about it!

8
  • This does not seem to work in Chrome 22. My har object has no request property. Only a log property with an array entries. Can't find an easy way to spit out unformatted POST test from this object. :-/
    – The111
    Jun 12, 2013 at 21:18
  • It seems in Chrome 22 when I copy the POST request as a har, it also copies all other requests that were made as part of a re-direct received in the response. That is what the array of entries mentioned above is. So har.log.entries[0].request.postData.text will get the body of the original request.
    – The111
    Jun 12, 2013 at 21:29
  • @The111 Just updated the answer. Does the new method work for you? (I also would be interested in learning why you're using outdated Chrome 22.)
    – feklee
    Jun 12, 2013 at 21:58
  • I'm on a work computer without admin privs. This outdated installation of Chrome is the one provided by IT auto-install. :-/ They do everything like that here... still using Java 1.6! It's not a tech company. And yes your updated solution appears to be the same as what I'm doing now. Thanks.
    – The111
    Jun 12, 2013 at 22:41
  • this answer is now outdated. Chrome console provides this feature already. Just click the request in network tab. Then, click view source in "Form Data" tab in the opening panel.
    – Onur Demir
    Feb 14, 2017 at 9:00
10

it's easier if you:

  1. go to Network
  2. click the entry you want to see the post for
  3. click on the headers tab
  4. scroll down to Form Data
2
  • 2
    This was the method the OP was using but says it doesn't suit his/her needs.
    – Ian Hunter
    Jul 26, 2012 at 4:02
  • 1
    Form Data -> view source might do it. Maybe that's a new feature. Jan 11, 2016 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.