class Bezel::Plug::MethodOverride

include Bezel::Plug

Lets an HTML form send PUT, PATCH or DELETE: a POST whose body has _method set to one of them (in any case) gets that method. It reads the body's parameters, so it comes after Bezel::Plug::Parsers; the query's _method is not believed (a link could carry it).

req = HTTP::Server::Request.post("/users/1", "_method=delete",
  HTTP::Headers.of({"Content-Type" => "application/x-www-form-urlencoded"}))
conn = Bezel::Plug.run([Bezel::Plug::Parsers.new, Bezel::Plug::MethodOverride.new], Bezel::Conn.build(req))
conn.method        # => "DELETE"

src/plug/method_override.qz:12

Constants

METHODS: Array[String]

The methods a form may ask for.

src/plug/method_override.qz:19

Class methods

def self.new -> Bezel::Plug::MethodOverride

The plug.

src/plug/method_override.qz:16

Methods

def call(conn: Bezel::Conn) -> Bezel::Conn

The connection changed by this plug.

from Bezel::Plug

src/plug/method_override.qz:21