Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultHijackOptions = HijackOptions{ ContentType: "application/json", Render: json.Marshal, }
DefaultHijackOptions is used as Middleware options if no other options are specified.
Default encoding is JSON.
Functions ¶
func Middleware ¶
func Middleware(options ...HijackOptions) func(http.Handler) http.Handler
Middleware is a middleware that enables automatic routing schema self-description, when making an "OPTIONS" HTTP request to the chi.Router instance that uses this middleware.
The HTTP Response this middleware produces contains an Routes object. See the documentation
Options can be passed through by using an HijackOptions object to this function. Keep in mind that only the first passed HijackOptions instance will be used as actual options.
Types ¶
type HijackOptions ¶
HijackOptions specifies options for the Middleware middleware, such as:
- "Content-Type" header and serialization function
- Policy check logic to hide sensible paths from unauthorized users
type RenderFn ¶
RenderFn is a function that takes the output of the middleware and serialize it in a certain encoding.