File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,13 +23,15 @@ function simpleGet (opts, cb) {
2323 if ( opts . body ) body = opts . json && ! isStream ( opts . body ) ? JSON . stringify ( opts . body ) : opts . body
2424
2525 if ( opts . json ) opts . headers . accept = 'application/json'
26- if ( opts . json && body ) opts . headers [ 'content-type' ] = 'application/json'
2726 if ( opts . form ) opts . headers [ 'content-type' ] = 'application/x-www-form-urlencoded'
28- if ( body && ! isStream ( body ) ) opts . headers [ 'content-length' ] = Buffer . byteLength ( body )
2927 delete opts . body
3028 delete opts . form
3129
32- if ( body && ! opts . method ) opts . method = 'POST'
30+ if ( body ) {
31+ if ( ! opts . method ) opts . method = 'POST'
32+ if ( ! isStream ( body ) ) opts . headers [ 'content-length' ] = Buffer . byteLength ( body )
33+ if ( opts . json ) opts . headers [ 'content-type' ] = 'application/json'
34+ }
3335
3436 // Request gzip/deflate
3537 var customAcceptEncoding = Object . keys ( opts . headers ) . some ( function ( h ) {
You can’t perform that action at this time.
0 commit comments