Skip to content

Commit

Permalink
Merge pull request #1 from Fdawgs/patch-1
Browse files Browse the repository at this point in the history
docs(readme): minor fixes
  • Loading branch information
mattbishop authored Aug 10, 2021
2 parents 93718ed + 0e1d33a commit b0710e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Fastify Allow Plugin
The HTTP 1.1 specification has an [`Allow` header](https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1) for resources to include in client responses, indicating all the methods the resource supports. All resource requests return the `Allow` header so client develpers can discover all of the allowable methods on the resource. If a resource does not support a method, for instance, `DELETE`, then the response status will be `405 Not Allowed` along with the `Allow` header.
The HTTP 1.1 specification has an [`Allow` header](https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1) for resources to include in client responses, indicating all the methods the resource supports. All resource requests return the `Allow` header so client developers can discover all of the allowable methods on the resource. If a resource does not support a method, for instance, `DELETE`, then the response status will be `405 Not Allowed` along with the `Allow` header.

This plugin adds an `Allow` header to all responses with routes that have registered handlers, regardless of the method they handle. It returns a `405 Not Allowed` response when a route has no supported method handler. This behaviour is different from Fastify's default behaviour, which is to return a `404 Not Found` for unhandled methodson a route.
This plugin adds an `Allow` header to all responses with routes that have registered handlers, regardless of the method they handle. It returns a `405 Not Allowed` response when a route has no supported method handler. This behaviour is different from Fastify's default behaviour, which is to return a `404 Not Found` for unhandled methods on a route.

If a route has no registered method handlers, fastify-allow will send the usual `404 Not Found` response.

Expand Down Expand Up @@ -58,4 +58,4 @@ const allowOpts: AllowOptions = { send405: false }
fastify.register(allowPlugin, allowOpts)

// now register handlers
```
```

0 comments on commit b0710e0

Please sign in to comment.