Ben Diamant Ben Diamant - 2 years ago 138
Node.js Question

Get HTTP version of incoming request

How can I extract the HTTP version of an incoming request using express?

I need something like:

app.use('/', (req, res, next) => {
req.getHttpVersion() // 'HTTP 1.0'/'HTTP 1.1'/'HTTP 2.0'

Answer Source

Try this:

app.use('/', (req, res, next) => {
    console.log('Request HTTP Version: ', req.httpVersion)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download