Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT/POST/PATCH request bodies don't show up in Chrome DevTools #2854

Open
RavenHursT opened this issue Jan 24, 2018 · 10 comments
Open

PUT/POST/PATCH request bodies don't show up in Chrome DevTools #2854

RavenHursT opened this issue Jan 24, 2018 · 10 comments

Comments

@RavenHursT
Copy link

I have a simple project that I'm doing this in:

import request from 'request'

request.put(`http://localhost:3000/api/homes/1234`, {
  headers: {
    Accept: `application/json`,
    ContentType: `application/json`
  },
  json: true,
  resolveWithFullResponse: true,
  body: {foo: `FOO`}
}).on(`response`, resp => {
  console.log(resp)
})

fetch(`http://localhost:3000/api/homes/4321`, {
  method: `PUT`,
  headers: {
    Accept: `application/json`,
    ContentType: `application/json`
  },
  credentials: 'include',
  body: JSON.stringify({bar: `bar`})
}).then(resp => {
  console.dir(resp, {colors:true, depth:2})
})

Expected Behavior

When I run said code, both requests in the Chrome DevTools "Network" tab, should have the "Request Payload" section displayed.

Current Behavior

Both requests successfully send a body over to the server side, and in both cases, I can verify this on the server api:

// Request-generated request headers and body:
{ headers: 
   { host: 'localhost:3000',
     connection: 'keep-alive',
     'content-length': '13',
     pragma: 'no-cache',
     'cache-control': 'no-cache',
     accept: 'application/json',
     origin: 'http://localhost:3000',
     contenttype: 'application/json',
     'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36',
     'content-type': 'application/json',
     referer: 'http://localhost:3000/visits/a35d559d-65ab-43de-adfd-518d697e9dd4',
     'accept-encoding': 'gzip, deflate, br',
     'accept-language': 'en-US,en;q=0.9'},
  body: { foo: 'FOO' } }

// Native-fetchAPI-generated request headers and body:
{ headers: 
   { host: 'localhost:3000',
     connection: 'keep-alive',
     'content-length': '13',
     pragma: 'no-cache',
     'cache-control': 'no-cache',
     accept: 'application/json',
     origin: 'http://localhost:3000',
     'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36',
     'content-type': 'application/json',
     referer: 'http://localhost:3000/visits/a35d559d-65ab-43de-adfd-518d697e9dd4',
     'accept-encoding': 'gzip, deflate, br',
     'accept-language': 'en-US,en;q=0.9' },
  body: { bar: 'bar' } }

But when I look at the requests in the Network tab in Chrome Devtools...

For Native FetchAPI request:

screen shot 2018-01-24 at 5 40 08 pm

For Request-generated request:

screen shot 2018-01-24 at 5 40 26 pm

Your Environment

software version
request latest
node 9.3
npm 5.6
Operating System OSX high Sierra, Chrome 64.0.3282.119
@RavenHursT
Copy link
Author

@mikeal Any possibility you might have an idea as to why this is happening?

@stale
Copy link

stale bot commented Feb 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 7, 2019
@RavenHursT
Copy link
Author

Guess not :-/

@stale stale bot removed the stale label Feb 7, 2019
@Revadike
Copy link

How do u even get a working network tab with node inspect?

@SiaKovalina
Copy link

Having the same issue

@rkopeiki
Copy link

Having the same issue with a file upload

@debMan
Copy link

debMan commented Jun 11, 2020

Having the same issue on no security mode of chromium.

@vivekpandey343
Copy link

Having the same issue with large file upload (size > 2.9MB)

@hishtadlut
Copy link

Having the same issue with large file upload (size > 15MB)

@BrusJan
Copy link

BrusJan commented Feb 24, 2023

Having the same issue with put request. Visual Studio code goes through the line this.httpClient.put... with no error, but developer console shows only other requests (POST ones) except this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants