MCPcopy Create free account

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

Functions372 in github.com/go-chi/chi

FunctionTestRedirectSlashes
(t *testing.T)
middleware/strip_test.go:102
FunctionTestRequestID
(t *testing.T)
middleware/request_id_test.go:20
FunctionTestRequestLogger
(t *testing.T)
middleware/logger_test.go:21
FunctionTestRequestLoggerReadFrom
(t *testing.T)
middleware/logger_test.go:38
FunctionTestRoutePattern
TestRoutePattern tests correct in-the-middle wildcard removals. If user organizes a router like this: (router.go) r.Route("/v1", func(r chi.Router)
context_test.go:24
FunctionTestRouterFromMuxWith
(t *testing.T)
mux_test.go:726
FunctionTestServeHTTPExistingContext
TODO: a Router wrapper test.. type ACLMux struct { *Mux XX string } func NewACLMux() *ACLMux { return &ACLMux{Mux: NewRouter(), XX: "hihi"} } TO
mux_test.go:1328
FunctionTestServerBaseContext
(t *testing.T)
mux_test.go:1817
FunctionTestSingleHandler
(t *testing.T)
mux_test.go:1284
FunctionTestSplit
(t *testing.T)
middleware/content_charset_test.go:94
FunctionTestStripSlashes
(t *testing.T)
middleware/strip_test.go:13
FunctionTestStripSlashesInRoute
(t *testing.T)
middleware/strip_test.go:56
FunctionTestStripSlashesWithNilContext
This tests a http.Handler that is not chi.Router In these cases, the routeContext is nil
middleware/strip_test.go:203
FunctionTestSunset
(t *testing.T)
middleware/sunset_test.go:12
FunctionTestThrottleBacklog
(t *testing.T)
middleware/throttle_test.go:17
FunctionTestThrottleClientTimeout
(t *testing.T)
middleware/throttle_test.go:58
FunctionTestThrottleMaximum
(t *testing.T)
middleware/throttle_test.go:146
FunctionTestThrottleTriggerGatewayTimeout
(t *testing.T)
middleware/throttle_test.go:90
FunctionTestTree
(t *testing.T)
tree_test.go:10
FunctionTestTreeFindPattern
(t *testing.T)
tree_test.go:417
FunctionTestTreeMoar
(t *testing.T)
tree_test.go:154
FunctionTestTreeRegexMatchWholeParam
(t *testing.T)
tree_test.go:387
FunctionTestTreeRegexp
(t *testing.T)
tree_test.go:270
FunctionTestTreeRegexpRecursive
(t *testing.T)
tree_test.go:336
FunctionTestURLFormat
(t *testing.T)
middleware/url_format_test.go:11
FunctionTestURLFormatInSubRouter
(t *testing.T)
middleware/url_format_test.go:52
FunctionTestWalker
(t *testing.T)
tree_test.go:512
FunctionTestWrapWriterHTTP2
(t *testing.T)
middleware/middleware_test.go:23
FunctionTestXForwardForIP
(t *testing.T)
middleware/realip_test.go:35
FunctionTestXForwardForXRealIPPrecedence
(t *testing.T)
middleware/realip_test.go:68
FunctionTestXRealIP
(t *testing.T)
middleware/realip_test.go:11
MethodTrace
Trace adds the route `pattern` that matches a TRACE http method to execute the `handlerFn` http.HandlerFunc.
mux.go:197
MethodTrace
(pattern string, h http.HandlerFunc)
chi.go:106
FunctionURLFormat
URLFormat is a middleware that parses the url extension from a request path and stores it on the context as a string under the key `middleware.URLForm
middleware/url_format.go:46
MethodUnwrap
Unwrap returns the original proxied target.
middleware/wrap_writer.go:64
MethodUnwrap
()
middleware/wrap_writer.go:131
MethodUnwrap
()
middleware/compress.go:380
MethodUpdate
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:42
MethodUpdate
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:43
FunctionUpdateArticle
UpdateArticle updates an existing Article in our persistent store.
_examples/rest/main.go:186
FunctionWithValue
WithValue is a middleware that sets a given key/value in a context chain.
middleware/value.go:9
MethodWrite
(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})
middleware/logger.go:134
MethodWrite
(p []byte)
middleware/compress.go:324
FunctioncustomHandler
(w http.ResponseWriter, r *http.Request)
_examples/custom-handler/main.go:26
FunctiondebugPrintTree
(parent int, i int, n *node, label byte)
tree_test.go:447
FunctionencoderDeflate
(w io.Writer, level int)
middleware/compress.go:392
FunctionencoderGzip
(w io.Writer, level int)
middleware/compress.go:384
MethodfindEdge
(label byte)
tree.go:821
FunctiongetArticle
(w http.ResponseWriter, r *http.Request)
_examples/versions/main.go:103
Functioninit
()
_examples/custom-method/main.go:10
Functioninit
This is entirely optional, but I wanted to demonstrate how you could easily add your own logic to the render.Respond method.
_examples/rest/main.go:258
Functioninit
()
middleware/middleware_test.go:18
Functioninit
()
middleware/logger.go:166
Functioninit
A quick note on the statistics here: we're trying to calculate the chance that two randomly generated base62 prefixes will collide. We use the formula
middleware/request_id.go:46
Functioninit
()
middleware/terminal.go:37
FunctionlistArticles
(w http.ResponseWriter, r *http.Request)
_examples/versions/main.go:71
Functionmain
Please see https://github.com/go-chi/httplog for a complete package and example for writing a structured logger on chi built on the Go 1.21+ "log/slog
_examples/logging/main.go:7
Functionmain
()
_examples/limits/main.go:21
Functionmain
()
_examples/custom-method/main.go:16
Functionmain
()
_examples/versions/main.go:22
Functionmain
()
_examples/custom-handler/main.go:20
Functionmain
()
_examples/todos-resource/main.go:14
Functionmain
()
_examples/rest/main.go:55
Functionmain
()
_examples/router-walk/main.go:11
Functionmain
()
_examples/fileserver/main.go:28
Functionmain
()
_examples/graceful/main.go:17
Functionmain
()
_examples/hello-world/main.go:10
Functionpaginate
paginate is a stub, but very possible to implement middleware logic to handle the request params for handling a paginated request.
_examples/rest/main.go:248
FunctionpanickingHandler
(http.ResponseWriter, *http.Request)
middleware/recoverer_test.go:13
FunctionrandomErrorMiddleware
(next http.Handler)
_examples/versions/main.go:142
MethodrouteHTTP
routeHTTP routes a http.Request through the Mux routing tree to serve the matching handler for a particular http method.
mux.go:426
FunctionsetPathValue
setPathValue sets the path values in the Request value based on the provided request context. setPathValue is only supported in Go 1.22 and above so
path_value_fallback.go:18
← previous301–372 of 372, ranked by callers