MCPcopy Create free account

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

Functions372 in github.com/go-chi/chi

↓ 1 callersMethodLen
()
tree.go:806
↓ 1 callersMethodMethodNotAllowedHandler
MethodNotAllowedHandler returns the default Mux 405 responder whenever a method cannot be resolved for a route.
mux.go:392
↓ 1 callersMethodMiddlewares
Middlewares returns the list of middlewares in use by the router.
chi.go:124
↓ 1 callersMethodNewLogEntry
(r *http.Request)
middleware/logger.go:64
↓ 1 callersFunctionNewMux
NewMux returns a newly initialized Mux object that implements the Router interface.
mux.go:52
↓ 1 callersFunctionNewUserPayloadResponse
(user *User)
_examples/rest/main.go:295
↓ 1 callersMethodPanic
(v interface{}, stack []byte)
middleware/logger.go:71
↓ 1 callersMethodPost
Post adds the route `pattern` that matches a POST http method to execute the `handlerFn` http.HandlerFunc.
mux.go:185
↓ 1 callersMethodPrint
(v ...interface{})
middleware/logger.go:88
↓ 1 callersFunctionRegisterMethod
RegisterMethod adds support for custom HTTP method handlers, available via Router#Method and Router#MethodFunc
tree.go:60
↓ 1 callersMethodRender
(w http.ResponseWriter, r *http.Request)
_examples/versions/presenter/v2/article.go:23
↓ 1 callersFunctionRequestLogger
RequestLogger returns a logger handler using a custom LogFormatter.
middleware/logger.go:44
↓ 1 callersMethodRoute
Route creates a new Mux and mounts it along the `pattern` as a subrouter. Effectively, this is a short-hand call to Mount. See _examples/.
mux.go:278
↓ 1 callersMethodSort
Sort the list of nodes by label
tree.go:805
↓ 1 callersFunctionStripSlashes
StripSlashes is a middleware that will match request paths with a trailing slash, strip it from the path and continue routing through the mux, if a ro
middleware/strip.go:13
↓ 1 callersFunctionSunset
Sunset set Deprecation/Sunset header to response This can be used to enable Sunset in a route or a route group For more: https://www.rfc-editor.org/rf
middleware/sunset.go:11
↓ 1 callersMethodSwap
(i, j int)
tree.go:807
↓ 1 callersFunctionThrottle
Throttle is a middleware that limits number of currently processed requests at a time across all users. Note: Throttle is not a rate-limiter per user,
middleware/throttle.go:31
↓ 1 callersFunctionTimeout
Timeout is a middleware that cancels ctx after a given timeout and return a 504 Gateway Timeout error to the client. It's required that you select th
middleware/timeout.go:32
↓ 1 callersFunctionURLParamFromCtx
URLParamFromCtx returns the url parameter from a http.Request Context.
context.go:18
↓ 1 callersMethodUse
Use appends a middleware handler to the Mux middleware stack. The middleware stack for any Mux will execute before searching for a matching route to
mux.go:100
↓ 1 callersFunctionWalk
Walk walks any router tree that implements Routes interface.
tree.go:853
↓ 1 callersMethodWith
With adds inline middlewares for an endpoint handler.
mux.go:242
↓ 1 callersFunctionWithLogEntry
WithLogEntry sets the in-context LogEntry for a request.
middleware/logger.go:81
↓ 1 callersMethodWriteHeader
(code int)
middleware/compress.go:296
↓ 1 callersMethodaddChild
addChild appends the new `child` node to the tree using the `pattern` as the trie key. For a URL router like chi's, we split the static, param, regexp
tree.go:233
↓ 1 callersFunctionadminRouter
A completely separate router for administrator routes
_examples/rest/main.go:219
↓ 1 callersFunctionapiVersionCtx
(version string)
_examples/versions/main.go:51
↓ 1 callersFunctionarticleRouter
()
_examples/versions/main.go:60
↓ 1 callersFunctionassertError
(t *testing.T, err error)
middleware/middleware_test.go:143
↓ 1 callersFunctionbasicAuthFailed
(w http.ResponseWriter, realm string)
middleware/basic_auth.go:30
↓ 1 callersFunctiondbGetArticle
(id string)
_examples/rest/main.go:475
↓ 1 callersFunctiondbGetArticleBySlug
(slug string)
_examples/rest/main.go:484
↓ 1 callersFunctiondbGetUser
(id int64)
_examples/rest/main.go:513
↓ 1 callersFunctiondbNewArticle
(article *Article)
_examples/rest/main.go:469
↓ 1 callersFunctiondbRemoveArticle
(id string)
_examples/rest/main.go:503
↓ 1 callersFunctiondbUpdateArticle
(id string, article *Article)
_examples/rest/main.go:493
↓ 1 callersFunctiondecodeResponseBody
(t *testing.T, resp *http.Response)
middleware/compress_test.go:197
↓ 1 callersMethoddecorateFuncCallLine
(line string, useColor bool, num int)
middleware/recoverer.go:126
↓ 1 callersMethoddecorateLine
(line string, useColor bool, num int)
middleware/recoverer.go:112
↓ 1 callersMethoddecorateSourceLine
(line string, useColor bool, num int)
middleware/recoverer.go:166
↓ 1 callersMethodfindRoute
Recursive edge traversal by checking all nodeTyp groups along the way. It's like searching through a multi-dimensional radix trie.
tree.go:399
↓ 1 callersMethodgetEdge
(ntyp nodeTyp, label, tail byte, prefix string)
tree.go:329
↓ 1 callersMethodisCompressible
()
middleware/compress.go:277
↓ 1 callersFunctionmaintainDefaultRequestID
()
middleware/request_id_test.go:12
↓ 1 callersFunctionmatchAcceptEncoding
(accepted []string, encoding string)
middleware/compress.go:243
↓ 1 callersFunctionmethodNotAllowedHandler
methodNotAllowedHandler is a helper function to respond with a 405, method not allowed. It sets the Allow header with the list of allowed methods for
mux.go:500
↓ 1 callersFunctionmethodTypString
(method methodTyp)
tree.go:793
↓ 1 callersMethodparse
(debugStack []byte, rvr interface{})
middleware/recoverer.go:69
↓ 1 callersFunctionpatParamKeys
(pattern string)
tree.go:759
↓ 1 callersFunctionrealIP
(r *http.Request)
middleware/realip.go:42
↓ 1 callersMethodreplaceChild
(label, tail byte, child *node)
tree.go:317
↓ 1 callersFunctionreplaceWildcards
replaceWildcards takes a route pattern and recursively replaces all occurrences of "/*/" to "/".
context.go:135
↓ 1 callersMethodselectEncoder
selectEncoder returns the encoder, the name of the encoder, and a closer function.
middleware/compress.go:214
↓ 1 callersFunctionservice
()
_examples/graceful/main.go:58
↓ 1 callersMethodsetEndpoint
(method methodTyp, handler http.Handler, pattern string)
tree.go:342
↓ 1 callersFunctionsetPathValue
setPathValue sets the path values in the Request value based on the provided request context.
path_value.go:15
↓ 1 callersMethodsetRetryAfterHeaderIfNeeded
setRetryAfterHeaderIfNeeded sets Retry-After HTTP header if corresponding retryAfterFn option of throttler is initialized.
middleware/throttle.go:127
↓ 1 callersMethodtailSort
tailSort pushes nodes with '/' as the tail to the end of the list for param nodes. The list order determines the traversal order.
tree.go:812
↓ 1 callersFunctiontestHandler
(t *testing.T, h http.Handler, method, path string, body io.Reader)
mux_test.go:1868
↓ 1 callersFunctiontestRequestNoRedirect
(t *testing.T, ts *httptest.Server, method, path string, body io.Reader)
middleware/middleware_test.go:106
↓ 1 callersFunctiontestRequestWithAcceptedEncodings
(t *testing.T, ts *httptest.Server, method, path string, encodings ...string)
middleware/compress_test.go:174
↓ 1 callersFunctionwalk
(r Routes, walkFn WalkFunc, parentRoute string, parentMw ...func(http.Handler) http.Handler)
tree.go:857
↓ 1 callersMethodwalk
(fn func(eps endpoints, subroutes Routes) bool)
tree.go:670
FunctionAdminOnly
AdminOnly middleware restricts access to just administrators.
_examples/rest/main.go:235
FunctionArticleCtx
ArticleCtx middleware is used to load an Article object from the URL parameters passed through as the request. In case the Article could not be found,
_examples/rest/main.go:124
FunctionBasicAuth
BasicAuth implements a simple middleware handler for adding basic http auth to a route.
middleware/basic_auth.go:10
FunctionBenchmarkMux
(b *testing.B)
mux_test.go:1883
FunctionBenchmarkTreeGet
(b *testing.B)
tree_test.go:487
MethodBind
(r *http.Request)
_examples/rest/main.go:327
FunctionCleanPath
CleanPath middleware will clean out double slash mistakes from a user's request path. For example, if a user requests /users//1 or //users////1 will b
middleware/clean_path.go:12
FunctionCompress
Compress is a middleware that compresses response body of a given content types to a data format based on Accept-Encoding request header. It uses a gi
middleware/compress.go:41
MethodConnect
Connect adds the route `pattern` that matches a CONNECT http method to execute the `handlerFn` http.HandlerFunc.
mux.go:149
MethodConnect
HTTP-method routing along `pattern`
chi.go:98
MethodCreate
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:34
MethodCreate
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:35
FunctionCreateArticle
CreateArticle persists the posted Article and returns it back to the client as an acknowledgement.
_examples/rest/main.go:155
MethodDelete
Delete adds the route `pattern` that matches a DELETE http method to execute the `handlerFn` http.HandlerFunc.
mux.go:155
MethodDelete
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:46
MethodDelete
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:47
FunctionDeleteArticle
DeleteArticle removes an existing Article from our persistent store.
_examples/rest/main.go:201
MethodDiscard
Discard causes all writes to the original ResponseWriter be discarded, instead writing only to the tee'd writer if it's set. The caller is responsible
middleware/wrap_writer.go:69
MethodFlush
()
middleware/wrap_writer.go:144
MethodFlush
()
middleware/wrap_writer.go:169
MethodFlush
()
middleware/compress.go:343
MethodGet
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:38
MethodGet
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/todos.go:39
FunctionGetArticle
GetArticle returns the specific Article. You'll notice it just fetches the Article right off the context, as its understood that if we made it this fa
_examples/rest/main.go:173
FunctionGetHead
GetHead automatically route undefined HEAD requests to GET handlers.
middleware/get_head.go:10
MethodHandle
Handle adds the route `pattern` that matches any http method to execute the `handler` http.Handler.
mux.go:109
MethodHandleFunc
HandleFunc adds the route `pattern` that matches any http method to execute the `handlerFn` http.HandlerFunc.
mux.go:121
MethodHandler
(next http.Handler)
middleware/route_headers.go:77
MethodHead
Head adds the route `pattern` that matches a HEAD http method to execute the `handlerFn` http.HandlerFunc.
mux.go:167
FunctionHeartbeat
Heartbeat endpoint middleware useful to setting up a path like `/ping` that load balancers or uptime testing external services can make a request befo
middleware/heartbeat.go:12
MethodHijack
()
middleware/wrap_writer.go:175
MethodHijack
()
middleware/wrap_writer.go:197
MethodHijack
()
middleware/logger_test.go:17
MethodHijack
()
middleware/compress.go:359
MethodLess
(i, j int)
tree.go:808
MethodList
(w http.ResponseWriter, r *http.Request)
_examples/todos-resource/users.go:30
← previousnext →101–200 of 372, ranked by callers