-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: correctly translate HTTP method
PR-URL: #52701 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
1 parent
b0e6a6b
commit ad9c4bd
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const { strictEqual } = require('assert'); | ||
const { createServer, request } = require('http'); | ||
|
||
const server = createServer(common.mustCall((req, res) => { | ||
strictEqual(req.method, 'QUERY'); | ||
res.end('OK'); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const req = request({ port: server.address().port, method: 'QUERY' }, common.mustCall((res) => { | ||
strictEqual(res.statusCode, 200); | ||
|
||
let buffer = ''; | ||
res.setEncoding('utf-8'); | ||
|
||
res.on('data', (c) => buffer += c); | ||
res.on('end', common.mustCall(() => { | ||
strictEqual(buffer, 'OK'); | ||
server.close(); | ||
})); | ||
})); | ||
|
||
req.end(); | ||
})); |