Skip to content

HEAD route is not automatically added for GET routes #71

@onebytegone

Description

@onebytegone

For all GET routes, express will add support for HEAD requests automatically if a HEAD route is not already defined. lambda-express does not do this. At this time you must manually add the HEAD route.

Express docs: https://expressjs.com/en/api.html#router.METHOD

The router.get() function is automatically called for the HTTP HEAD method in addition to the GET method if router.head() was not called for the path before router.get().

Express sample:

$ cat index.js
const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

$ curl --head http://localhost:3000
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/html; charset=utf-8
Content-Length: 12
ETag: W/"c-Lve95gjOVATpfV8EL5X4nxwjKHE"
Date: Sat, 11 Jul 2020 01:40:25 GMT
Connection: keep-alive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions