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

HEAD route is not automatically added for GET routes #71

Open
onebytegone opened this issue Jul 11, 2020 · 0 comments
Open

HEAD route is not automatically added for GET routes #71

onebytegone opened this issue Jul 11, 2020 · 0 comments

Comments

@onebytegone
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant