0
使用節點new http2服務器時,我試圖從瀏覽器調用它時遇到此錯誤:ERR_INVALID_HTTP_RESPONSE。nodejs上的ERR_INVALID_HTTP_RESPONSE http2
代碼:
const http2 = require('http2');
// Create a plain-text HTTP/2 server
const server = http2.createServer();
server.on('stream', (stream, headers) => {
console.log('headers: ', headers);
stream.respond({
'content-type': 'text/html',
':status': 200
});
stream.end('<h1>Hello World</h1>');
});
server.listen(80);