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...

Caramiriel
  • 7,029
  • 3
  • 30
  • 50
feklee
  • 7,555
  • 9
  • 54
  • 72
  • related: ["Where is the POST tab in Chrome?"](http://superuser.com/questions/395919/where-is-the-post-tab-in-chrome-developer-tools-network) – David Cary Nov 16 '13 at 18:10
  • related: ["Is it possible to see the data of a post request in Firefox or Chrome?"](http://stackoverflow.com/questions/1622457/is-it-possible-to-see-the-data-of-a-post-request-in-firefox-or-chrome) – David Cary Nov 16 '13 at 18:14

2 Answers2

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!

feklee
  • 7,555
  • 9
  • 54
  • 72
  • 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 '13 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 '13 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 '13 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 '13 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 '17 at 09:00
  • @aod That's what you find at the top of the answer, and it still works that way, or are you referring to something else? – feklee Feb 14 '17 at 12:15
  • @feklee You have just updated your answer. That was the thing that I wanted to mention. The answer was old but working anyway. However, there was a new easy way. And you added it to your answer. :thumbsup: – Onur Demir Feb 14 '17 at 12:19
  • @aod That *easy new way* I added to the answer in 2013, i.e. when Chrome 29 was around! Look at the [revisions](http://stackoverflow.com/posts/9163566/revisions). What I added today is the *Request Payload* option. – feklee Feb 14 '17 at 19:34
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
Tiberiu Petcu
  • 822
  • 7
  • 10