MCPcopy Create free account

hub / github.com/go-chi/chi / functions

Functions372 in github.com/go-chi/chi

MethodList
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:31
FunctionListArticles
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:114
FunctionLogger
Logger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was
middleware/logger.go:39
MethodMatch
Match searches the routing tree for a handler that matches the method/path. It's similar to routing a http request, but without executing the handler
mux.go:365
MethodMatch
(v string)
middleware/route_headers.go:146
FunctionMaybe
Maybe middleware will allow you to change the flow of the middleware stack execution depending on return value of maybeFn(request). This is useful for
middleware/maybe.go:8
MethodMethodFunc
MethodFunc adds the route `pattern` that matches `method` http method to execute the `handlerFn` http.HandlerFunc.
mux.go:143
MethodMethodNotAllowed
MethodNotAllowed sets a custom http.HandlerFunc for routing paths where the method is unresolved. The default handler returns a 405 with an empty body
mux.go:223
MethodMiddlewares
Middlewares returns a slice of middleware handler functions.
mux.go:355
FunctionNew
New will create a new middleware handler from a http.Handler.
middleware/middleware.go:6
MethodNewLogEntry
NewLogEntry creates a new LogEntry for the request.
middleware/logger.go:98
FunctionNextRequestID
NextRequestID generates the next request ID in the sequence.
middleware/request_id.go:94
FunctionNoCache
NoCache is a simple piece of middleware that sets a number of HTTP headers to prevent a router (or subrouter) from being cached by an upstream proxy a
middleware/nocache.go:40
MethodNotFound
NotFound sets a custom http.HandlerFunc for routing paths that could not be found. The default 404 handler is `http.NotFound`.
mux.go:203
MethodOptions
Options adds the route `pattern` that matches an OPTIONS http method to execute the `handlerFn` http.HandlerFunc.
mux.go:173
MethodOptions
(pattern string, h http.HandlerFunc)
chi.go:102
FunctionPageRoute
PageRoute is a simple middleware which allows you to route a static GET request at the middleware stack level.
middleware/page_route.go:10
MethodPanic
(v interface{}, stack []byte)
middleware/logger.go:162
MethodPatch
Patch adds the route `pattern` that matches a PATCH http method to execute the `handlerFn` http.HandlerFunc.
mux.go:179
MethodPatch
(pattern string, h http.HandlerFunc)
chi.go:103
FunctionPathRewrite
PathRewrite is a simple middleware which allows you to rewrite the request URL path.
middleware/path_rewrite.go:9
FunctionPing
Ping returns pong
_examples/router-walk/main.go:40
FunctionPresentError
(r *http.Request, err error)
_examples/versions/data/errors.go:16
FunctionProfiler
Profiler is a convenient subrouter used for mounting net/http/pprof. ie. func MyService() http.Handler { r := chi.NewRouter() // ..middlewares
middleware/profiler.go:20
MethodPush
(target string, opts *http.PushOptions)
middleware/wrap_writer.go:202
MethodPush
(target string, opts *http.PushOptions)
middleware/compress.go:366
MethodPut
Put adds the route `pattern` that matches a PUT http method to execute the `handlerFn` http.HandlerFunc.
mux.go:191
MethodReadFrom
(r io.Reader)
middleware/wrap_writer.go:206
FunctionRealIP
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing either the True-Client-IP, X-Real-IP or the X-Forwarded-For hea
middleware/realip.go:31
FunctionRecoverer
Recoverer is a middleware that recovers from panics, logs the panic (and a backtrace), and returns a HTTP 500 (Internal Server Error) status if possib
middleware/recoverer.go:22
FunctionRedirectSlashes
RedirectSlashes is a middleware that will match request paths with a trailing slash and redirect to the same path, less the trailing slash. NOTE: Red
middleware/strip.go:40
MethodRender
(w http.ResponseWriter, r *http.Request)
_examples/versions/presenter/v3/article.go:25
MethodRender
(w http.ResponseWriter, r *http.Request)
_examples/versions/presenter/v1/article.go:16
MethodRender
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:372
MethodRender
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:410
FunctionRequestID
RequestID is a middleware that injects a request ID into the context of each request. A request ID is a string of the form "host.example.com/random-00
middleware/request_id.go:67
FunctionRequestSize
RequestSize is a middleware that will limit request sizes to a specified number of bytes. It uses MaxBytesReader to do so.
middleware/request_size.go:9
MethodReset
Reset a routing context to its initial state.
context.go:82
MethodRoute
(header, match string, middlewareHandler func(next http.Handler) http.Handler)
middleware/route_headers.go:48
MethodRouteAny
(header string, match []string, middlewareHandler func(next http.Handler) http.Handler)
middleware/route_headers.go:58
MethodRouteDefault
(handler func(next http.Handler) http.Handler)
middleware/route_headers.go:72
FunctionRouteHeaders
RouteHeaders is a neat little header-based router that allows you to direct the flow of a request through a middleware stack based on a request header
middleware/route_headers.go:42
MethodRoutes
Routes returns a slice of routing information from the tree, useful for traversing available routes of a router.
mux.go:350
MethodRoutes
Routes creates a REST router for the todos resource
_examples/todos-resource/users.go:12
MethodRoutes
Routes creates a REST router for the todos resource
_examples/todos-resource/todos.go:12
FunctionSearchArticles
SearchArticles searches the Articles data for a matching article. It's just a stub, but you get the idea.
_examples/rest/main.go:149
MethodServeHTTP
(w http.ResponseWriter, r *http.Request)
chain.go:30
FunctionSetHeader
SetHeader is a convenience handler to set a response header key/value
middleware/content_type.go:9
MethodStatus
()
middleware/wrap_writer.go:119
MethodString
()
context.go:160
FunctionSupressNotFound
SupressNotFound will quickly respond with a 404 if the route is not found and will not continue to the next middleware handler. This is handy to put
middleware/supress_notfound.go:15
MethodSync
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:51
MethodTee
Tee causes the response body to be written to the given io.Writer in addition to proxying the writes through. Only one io.Writer can be tee'd to at on
middleware/wrap_writer.go:62
FunctionTestBasicWriterDiscardsWritesToOriginalResponseWriter
(t *testing.T)
middleware/wrap_writer_test.go:48
FunctionTestBasicWritesTeesWritesWithoutDiscard
(t *testing.T)
middleware/wrap_writer_test.go:28
FunctionTestCompressor
(t *testing.T)
middleware/compress_test.go:17
FunctionTestCompressorWildcards
(t *testing.T)
middleware/compress_test.go:114
FunctionTestContentCharset
(t *testing.T)
middleware/content_charset_test.go:11
FunctionTestContentEncoding
(t *testing.T)
middleware/content_charset_test.go:113
FunctionTestContentEncodingMiddleware
(t *testing.T)
middleware/content_encoding_test.go:12
FunctionTestContentType
(t *testing.T)
middleware/content_type_test.go:12
FunctionTestCustomHTTPMethod
(t *testing.T)
mux_test.go:1753
FunctionTestEscapedURLParams
(t *testing.T)
mux_test.go:1713
FunctionTestGetHead
(t *testing.T)
middleware/get_head_test.go:11
FunctionTestHttp2FancyWriterRemembersWroteHeaderWhenFlushed
(t *testing.T)
middleware/wrap_writer_test.go:19
FunctionTestHttpFancyWriterRemembersWroteHeaderWhenFlushed
(t *testing.T)
middleware/wrap_writer_test.go:10
FunctionTestInvalidIP
(t *testing.T)
middleware/realip_test.go:93
FunctionTestMethodNotAllowed
(t *testing.T)
mux_test.go:395
FunctionTestMiddlewarePanicOnLateUse
(t *testing.T)
mux_test.go:1440
FunctionTestMountingExistingPath
(t *testing.T)
mux_test.go:1462
FunctionTestMountingSimilarPattern
(t *testing.T)
mux_test.go:1477
FunctionTestMuxBasic
(t *testing.T)
mux_test.go:17
FunctionTestMuxBig
(t *testing.T)
mux_test.go:877
FunctionTestMuxComplicatedNotFound
(t *testing.T)
mux_test.go:498
FunctionTestMuxContextIsThreadSafe
(t *testing.T)
mux_test.go:1677
FunctionTestMuxEmptyParams
(t *testing.T)
mux_test.go:1504
FunctionTestMuxEmptyRoutes
(t *testing.T)
mux_test.go:267
FunctionTestMuxHandlePatternValidation
(t *testing.T)
mux_test.go:643
FunctionTestMuxMatch
(t *testing.T)
mux_test.go:1779
FunctionTestMuxMiddlewareStack
(t *testing.T)
mux_test.go:746
FunctionTestMuxMissingParams
(t *testing.T)
mux_test.go:1524
FunctionTestMuxMounts
(t *testing.T)
mux_test.go:209
FunctionTestMuxNestedMethodNotAllowed
(t *testing.T)
mux_test.go:432
FunctionTestMuxNestedNotFound
(t *testing.T)
mux_test.go:317
FunctionTestMuxPlain
(t *testing.T)
mux_test.go:246
FunctionTestMuxRegexp
(t *testing.T)
mux_test.go:1572
FunctionTestMuxRegexp2
(t *testing.T)
mux_test.go:1588
FunctionTestMuxRegexp3
(t *testing.T)
mux_test.go:1604
FunctionTestMuxRouteGroups
(t *testing.T)
mux_test.go:821
FunctionTestMuxSubrouterWildcardParam
(t *testing.T)
mux_test.go:1645
FunctionTestMuxSubroutes
(t *testing.T)
mux_test.go:1169
FunctionTestMuxSubroutesBasic
(t *testing.T)
mux_test.go:1088
FunctionTestMuxTrailingSlash
Test a mux that routes a trailing slash, see also middleware/strip_test.go for an example of using a middleware to handle trailing slashes.
mux_test.go:286
FunctionTestMuxWildcardRoute
(t *testing.T)
mux_test.go:1546
FunctionTestMuxWildcardRouteCheckTwo
(t *testing.T)
mux_test.go:1559
FunctionTestMuxWith
(t *testing.T)
mux_test.go:590
FunctionTestNestedGroups
(t *testing.T)
mux_test.go:1384
FunctionTestPathValue
(t *testing.T)
path_value_test.go:13
FunctionTestRecoverer
(t *testing.T)
middleware/recoverer_test.go:15
FunctionTestRecovererAbortHandler
(t *testing.T)
middleware/recoverer_test.go:44
← previousnext →201–300 of 372, ranked by callers