Open masx200 opened 4 years ago
Using node-spdy to start the http2 server, some special request methods cannot be recognized.
For some strange request methods,req.method is null
req.method
null
index.js
var spdy = require('spdy'); var fs = require('fs'); var options = { // Private key key: fs.readFileSync(__dirname + '/key.pem'), // Fullchain file or cert file (prefer the former) cert: fs.readFileSync(__dirname + '/cert.pem'), // **optional** SPDY-specific options }; var server = spdy.createServer(options, function (req, res) { res.writeHead(200); res.end('method:' + req.method); }); server.listen(3000);
package.json
{ "dependencies": { "spdy": "^4.0.2" } }
node -v v14.3.0
node index.js
Open it in chrome browser.
https://localhost:3000/
Enter the following code in the console in devtools,
fetch(location.href,{method:"GET"}).then(r=>r.text()).then(console.log) Promise {<pending>} method:GET
I made a HEAD method request but received the response body?
fetch(location.href,{method:"HEAD"}).then(r=>r.text()).then(console.log) Promise {<pending>} method:HEAD
Initiating certain requests, the method cannot be correctly identified.
fetch(location.href,{method:"MKWORKSPACE"}).then(r=>r.text()).then(console.log) Promise {<pending>} method:null
fetch(location.href,{method:"VERSION-CONTROL"}).then(r=>r.text()).then(console.log) Promise {<pending>} method:null
fetch(location.href,{method:"UPDATE"}).then(r=>r.text()).then(console.log) Promise {<pending>} method:null
@indutny @anandsuresh @eee-c @anandsuresh @daviddias
Using node-spdy to start the http2 server, some special request methods cannot be recognized.
For some strange request methods,
req.method
isnull
index.js
package.json
Open it in chrome browser.
Enter the following code in the console in devtools,
I made a HEAD method request but received the response body?
Initiating certain requests, the method cannot be correctly identified.