File: routers_gorillamux.txt

package info (click to toggle)
golang-github-getkin-kin-openapi 0.124.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: sh: 344; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package gorillamux // import "github.com/getkin/kin-openapi/routers/gorillamux"

Package gorillamux implements a router.

It differs from the legacy router: * it provides somewhat granular errors: "path
not found", "method not allowed". * it handles matching routes with extensions
(e.g. /books/{id}.json) * it handles path patterns with a different syntax (e.g.
/params/{x}/{y}/{z:.*})

FUNCTIONS

func NewRouter(doc *openapi3.T) (routers.Router, error)
    NewRouter creates a gorilla/mux router. Assumes spec is .Validate()d Note
    that a variable for the port number MUST have a default value and only this
    value will match as the port (see issue #367).


TYPES

type Router struct {
	// Has unexported fields.
}
    Router helps link http.Request.s and an OpenAPIv3 spec

func (r *Router) FindRoute(req *http.Request) (*routers.Route, map[string]string, error)
    FindRoute extracts the route and parameters of an http.Request