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

Using node-spdy to start the http2 server, some special request methods cannot be recognized. #370

Open
masx200 opened this issue Jun 5, 2020 · 1 comment

Comments

@masx200
Copy link

masx200 commented Jun 5, 2020

Using node-spdy to start the http2 server, some special request methods cannot be recognized.

For some strange request methods,req.method is 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant