Skip to content

corsicanec82/fastify-method-override

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

fastify-method-override

github action status Codacy Badge test coverage npm version

Plugin for Fastify, which allows use HTTP verbs, such as DELETE, PATCH, HEAD, PUT, OPTIONS in case the client doesn't support them. Supports Fastify versions >=2.0.0.

Install

$ npm install fastify-method-override

Usage

import fastify from 'fastify';
import fastifyMethodOverride from 'fastify-method-override';

const app = fastify();

app.register(fastifyMethodOverride);

To override the HTTP method, use the HTML form with the hidden _method field and the value of the target method:

<form method="POST" action="/url">
  <input type="hidden" name="_method" value="DELETE">
  <input type="submit" value="Submit">
</form>

Note

If you use setNotFoundHandler, the plugin may not work correctly. In order to override the standard 404 error handler, you must use setErrorHandler.

If you are having trouble using the plugin, you can use the fastify-method-override-wrapper library.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •