Skip to content

Commit

Permalink
GET methods should not have bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Jun 12, 2024
1 parent e0b1736 commit ba00247
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/client-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = class HTTPClientRequest extends HTTPOutgoingMessage {
this.headers = { host: host + ':' + port, ...opts.headers }

this._connection = connection
this._chunked = true
this._chunked = method !== 'GET' && method !== 'HEAD'

this._pendingFinal = null

Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ test('chunked', async function (t) {
await waitForServer(server)

const reply = await request({
method: 'GET',
method: 'POST',
host: server.address().address,
port: server.address().port,
path: '/'
Expand Down Expand Up @@ -362,7 +362,7 @@ test('server and client do big writes', async function (t) {
await waitForServer(server)

const reply = await request({
method: 'GET',
method: 'POST',
host: server.address().address,
port: server.address().port,
path: '/'
Expand Down

0 comments on commit ba00247

Please sign in to comment.