Chrome: Source of Post Data?
Asked Answered
B

2

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

Barbuto answered 6/2, 2012 at 16:14 Comment(2)
related: "Where is the POST tab in Chrome?"Formulate
related: "Is it possible to see the data of a post request in Firefox or Chrome?"Formulate
B
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!

Barbuto answered 6/2, 2012 at 16:34 Comment(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. :-/Athodyd
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.Athodyd
@Athodyd 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.)Barbuto
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.Athodyd
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.Sites
@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?Barbuto
@Barbuto 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:Sites
@aod That easy new way I added to the answer in 2013, i.e. when Chrome 29 was around! Look at the revisions. What I added today is the Request Payload option.Barbuto
C
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
Cully answered 25/7, 2012 at 16:2 Comment(2)
This was the method the OP was using but says it doesn't suit his/her needs.Rivera
Form Data -> view source might do it. Maybe that's a new feature.Elizabethelizabethan

© 2022 - 2024 — McMap. All rights reserved.