Issue Tracker GoDoc Chat License

Buy Me A Coffee Support Me

verbmux is an HTTP multiplexer that can be used to route HTTP requests in Go programs based on their verb (GET, SET, HEAD, etc). It handles OPTIONS requests automatically and is designed to be composable with other HTTP routers.

Use it in your program with:

import (



    Package verbmux provides functionality for a simple HTTP multiplexer that routes requests based on the HTTP verb (GET, POST, CONNECT, etc.). It can handle OPTIONS requests automatically.



    This section is empty.


    This section is empty.


    func New

    func New(v ...Verb) http.Handler

      New constructs a new multiplexer that responds to requests with the provided verb's. OPTIONS requests are automatically handled unless they are overridden.


      type Verb

      type Verb func(vm verbMux)

        Verb represents an HTTP verb such as GET or PUT. Verbs should not be created manually, instead use Custom or one of the existing verb functions.

        func Custom

        func Custom(verb string, handler http.Handler) Verb

          Custom handles custom HTTP verbs, for example, if you wanted to handle the WebDAV LOCK or UNLOCK verbs.

          func Delete

          func Delete(handler http.Handler) Verb

            Delete handles HTTP DELETE requests.

            func Get

            func Get(handler http.Handler) Verb

              Get handles HTTP GET requests.

              func Options

              func Options(handler http.Handler) Verb

                Options handles HTTP OPTIONS requests. A new verb muxer handles OPTIONS requests by default, so an Options verb only needs to be specified if custom behavior is desired, or OPTIONS requests should not be handled (by passing a nil handler).

                func Post

                func Post(handler http.Handler) Verb

                  Post handles HTTP POST requests.

                  func Put

                  func Put(handler http.Handler) Verb

                    Put handles HTTP PUT requests.

                    Source Files