MCPcopy Create free account

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

Functions435 in github.com/go-chi/chi

↓ 103 callersMethodGet
(pattern string, h http.HandlerFunc)
chi.go:99
↓ 87 callersMethodWrite
(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})
middleware/logger.go:70
↓ 72 callersMethodHandlerFunc
HandlerFunc builds and returns a http.Handler from the chain of middlewares, with `h http.Handler` as the final handler.
chain.go:18
↓ 72 callersMethodServeHTTP
ServeHTTP is the single method of the http.Handler interface that makes Mux interoperable with the standard library. It uses a sync.Pool to get and re
mux.go:63
↓ 56 callersMethodClose
()
middleware/compress.go:379
↓ 51 callersMethodUse
Use appends one or more middlewares onto the Router stack.
chi.go:71
↓ 47 callersFunctionNewRouter
NewRouter returns a new Mux object that implements the Router interface.
chi.go:60
↓ 32 callersMethodWriteHeader
(code int)
middleware/wrap_writer.go:82
↓ 30 callersFunctiontestRequest
(t *testing.T, ts *httptest.Server, method, path string, body io.Reader)
mux_test.go:2038
↓ 28 callersMethodRoute
Route mounts a sub-Router along a `pattern` string.
chi.go:81
↓ 25 callersMethodAdd
Add will append a URL parameter to the end of the route param
context.go:152
↓ 23 callersMethodValue
(method methodTyp)
tree.go:139
↓ 14 callersFunctionURLParam
URLParam returns the url parameter from a http.Request object.
context.go:10
↓ 13 callersFunctionNewRouteContext
NewRouteContext returns a new routing Context object.
context.go:33
↓ 13 callersMethodhandle
handle registers a http.Handler in the routing tree for a particular http method and routing pattern.
mux.go:422
↓ 13 callersFunctionrun
run invokes mw with the request constructed by buildReq and returns the client IP captured inside the handler (or "" if none was set).
middleware/client_ip_test.go:706
↓ 12 callersMethodNotFound
NotFound defines a handler to respond whenever a route could not be found.
chi.go:110
↓ 12 callersMethodURLParam
URLParam returns the corresponding URL parameter value from the request routing context.
context.go:100
↓ 12 callersFunctionassertEqual
(t *testing.T, a, b interface{})
middleware/middleware_test.go:149
↓ 11 callersFunctionClientIPFromXFF
ClientIPFromXFF stores the client IP read from the X-Forwarded-For header, walking the chain right-to-left and skipping any IP that falls within one o
middleware/client_ip.go:92
↓ 11 callersMethodMount
Mount attaches another http.Handler along ./pattern/*
chi.go:84
↓ 10 callersMethodPost
(pattern string, h http.HandlerFunc)
chi.go:103
↓ 10 callersMethodString
()
middleware/middleware.go:21
↓ 10 callersFunctiontestRequest
(t *testing.T, ts *httptest.Server, method, path string, body io.Reader)
middleware/middleware_test.go:82
↓ 9 callersFunctionGetClientIP
GetClientIP returns the client IP as a string, as set by one of the ClientIPFrom* middlewares. Returns "" if no valid IP was set. Convenient for loggi
middleware/client_ip.go:203
↓ 8 callersMethodFindRoute
(rctx *Context, method methodTyp, path string)
tree.go:383
↓ 8 callersMethodInsertRoute
(method methodTyp, pattern string, handler http.Handler)
tree.go:148
↓ 7 callersMethodReset
(w io.Writer)
middleware/compress.go:270
↓ 7 callersMethodWith
With adds inline middlewares for an endpoint handler.
chi.go:74
↓ 7 callersFunctionassertNoError
(t *testing.T, err error)
middleware/middleware_test.go:135
↓ 6 callersFunctionClientIPFromHeader
ClientIPFromHeader stores the client IP from a single-IP header set by your reverse proxy. Read it with [GetClientIP]. Only safe with headers your pr
middleware/client_ip.go:41
↓ 6 callersMethodGroup
Group adds a new inline-Router along the current routing path, with a fresh middleware stack for the inline-Router.
chi.go:78
↓ 6 callersMethodHandleFunc
(pattern string, h http.HandlerFunc)
chi.go:89
↓ 6 callersMethodMatch
Match searches the routing tree for a handler that matches the method/path - similar to routing a http request, but without executing the handler ther
chi.go:129
↓ 6 callersMethodPut
(pattern string, h http.HandlerFunc)
chi.go:104
↓ 6 callersMethodRender
(w http.ResponseWriter, r *http.Request)
_examples/rest/main.go:305
↓ 6 callersMethodServeHTTP
(w http.ResponseWriter, r *http.Request)
_examples/custom-handler/main.go:12
↓ 5 callersMethodFlush
()
middleware/compress.go:346
↓ 5 callersMethodHandle
Handle and HandleFunc adds routes for `pattern` that matches all HTTP methods.
chi.go:88
↓ 5 callersMethodHead
(pattern string, h http.HandlerFunc)
chi.go:100
↓ 5 callersFunctionNewArticleResponse
(article *Article)
_examples/rest/main.go:360
↓ 5 callersFunctionThrottleBacklog
ThrottleBacklog is a middleware that limits number of currently processed requests at a time and provides a backlog for holding a finite number of pen
middleware/throttle.go:39
↓ 5 callersFunctionWalk
Walk walks any router tree that implements Routes interface.
tree.go:882
↓ 5 callersFunctioncW
colorWrite
middleware/terminal.go:55
↓ 5 callersMethodwriter
()
middleware/compress.go:338
↓ 4 callersFunctionChain
Chain returns a Middlewares type from a slice of middleware handlers.
chain.go:6
↓ 4 callersMethodDelete
(pattern string, h http.HandlerFunc)
chi.go:98
↓ 4 callersMethodMethodFunc
(method, pattern string, h http.HandlerFunc)
chi.go:94
↓ 4 callersMethodNotFoundHandler
NotFoundHandler returns the default Mux 404 responder whenever a route cannot be found.
mux.go:404
↓ 4 callersFunctionRouteContext
RouteContext returns chi's routing Context object from a http.Request Context.
context.go:27
↓ 4 callersMethodStatus
Status returns the HTTP status of the request, or 0 if one has not yet been sent.
middleware/wrap_writer.go:52
↓ 4 callersFunctionThrottleWithOpts
ThrottleWithOpts is a middleware that limits number of currently processed requests using passed ThrottleOpts.
middleware/throttle.go:44
↓ 4 callersFunctionstringSliceEqual
(a, b []string)
tree_test.go:477
↓ 4 callersFunctionwalkXFF
walkXFF walks the entries of the merged X-Forwarded-For chain RIGHT-TO-LEFT, invoking visit on each trimmed non-empty entry. visit returns true to sto
middleware/client_ip.go:228
↓ 3 callersMethodBytesWritten
BytesWritten returns the total number of bytes sent to the client.
middleware/wrap_writer.go:54
↓ 3 callersFunctionClientIPFromXFFTrustedProxies
ClientIPFromXFFTrustedProxies stores the client IP read from X-Forwarded-For, given the exact number of trusted reverse proxies between this server an
middleware/client_ip.go:149
↓ 3 callersFunctionErrInvalidRequest
(err error)
_examples/rest/main.go:415
↓ 3 callersFunctionGetClientIPAddr
GetClientIPAddr returns the client IP as a [netip.Addr], as set by one of the ClientIPFrom* middlewares. The returned Addr is the zero value if not se
middleware/client_ip.go:215
↓ 3 callersMethodMethodNotAllowed
MethodNotAllowed defines a handler to respond whenever a method is not allowed.
chi.go:114
↓ 3 callersFunctionNewCompressor
NewCompressor creates a new Compressor that will handle encoding responses. The level should be one of the ones defined in the flate package. The typ
middleware/compress.go:72
↓ 3 callersFunctionNewPattern
(value string)
middleware/route_headers.go:135
↓ 3 callersMethodPrint
(v ...interface{})
middleware/logger.go:88
↓ 3 callersMethodQuery
(pattern string, h http.HandlerFunc)
chi.go:105
↓ 3 callersMethodRoutePattern
RoutePattern builds the routing pattern string for the particular request, at the particular point during routing. This means, the value will change t
context.go:123
↓ 3 callersMethodRoutes
Routes returns the routing tree in an easily traversable structure.
chi.go:121
↓ 3 callersMethodString
()
mux_test.go:2072
↓ 3 callersFunctionchain
chain builds a http.Handler composed of an inline middleware stack and endpoint handler in the order they are passed.
chain.go:36
↓ 3 callersFunctionparseHeaderAddr
parseHeaderAddr parses s and normalizes for storage: v4-mapped IPv6 (::ffff:a.b.c.d) folds to plain v4, IPv6 zone is stripped. Both defend the trust-p
middleware/client_ip.go:268
↓ 3 callersFunctionpatNextSegment
patNextSegment returns the next segment details from a pattern: node type, param key, regexp string, param tail byte, param starting index, param endi
tree.go:735
↓ 2 callersMethodBind
Bind on UserPayload will run after the unmarshalling is complete, its a good time to focus some post-processing after a decoding.
_examples/rest/main.go:301
↓ 2 callersMethodBytesWritten
()
middleware/wrap_writer.go:126
↓ 2 callersFunctionErrRender
(err error)
_examples/rest/main.go:424
↓ 2 callersMethodFind
Find searches the routing tree for the pattern that matches the method/path.
chi.go:133
↓ 2 callersFunctionGetReqID
GetReqID returns a request ID from the given context if one is present. Returns the empty string if a request ID cannot be found.
middleware/request_id.go:83
↓ 2 callersMethodHandler
Handler builds and returns a http.Handler from the chain of middlewares, with `h http.Handler` as the final handler.
chain.go:12
↓ 2 callersMethodHandler
Handler returns a new middleware that will compress the response based on the current Compressor.
middleware/compress.go:199
↓ 2 callersMethodHijack
()
middleware/wrap_writer.go:160
↓ 2 callersMethodLen
()
tree.go:835
↓ 2 callersMethodMethod
Method adds the route `pattern` that matches `method` http method to execute the `handler` http.Handler.
mux.go:127
↓ 2 callersMethodMethod
Method and MethodFunc adds routes for `pattern` that matches the `method` HTTP method.
chi.go:93
↓ 2 callersMethodMount
Mount attaches another http.Handler or chi Router as a subrouter along a routing path. It's very useful to split up a large API as many independent ro
mux.go:295
↓ 2 callersFunctionNewArticleListResponse
(articles []*Article)
_examples/rest/main.go:378
↓ 2 callersFunctionNewArticleResponse
(article *data.Article)
_examples/versions/presenter/v2/article.go:28
↓ 2 callersFunctionNewArticleResponse
(article *data.Article)
_examples/versions/presenter/v3/article.go:37
↓ 2 callersFunctionNewArticleResponse
(article *data.Article)
_examples/versions/presenter/v1/article.go:20
↓ 2 callersFunctionNewMux
NewMux returns a newly initialized Mux object that implements the Router interface.
mux.go:52
↓ 2 callersFunctionNewWrapResponseWriter
NewWrapResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.
middleware/wrap_writer.go:15
↓ 2 callersMethodReadFrom
(r io.Reader)
middleware/wrap_writer.go:209
↓ 2 callersFunctionRequestLogger
RequestLogger returns a logger handler using a custom LogFormatter.
middleware/logger.go:44
↓ 2 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
↓ 2 callersMethodSetEncoder
SetEncoder can be used to set the implementation of a compression algorithm. The encoding should be a standardised identifier. See: https://developer
middleware/compress.go:159
↓ 2 callersMethodTee
(w io.Writer)
middleware/wrap_writer.go:130
↓ 2 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
↓ 2 callersMethodWith
With adds inline middlewares for an endpoint handler.
mux.go:242
↓ 2 callersMethodWrite
(buf []byte)
middleware/wrap_writer.go:96
↓ 2 callersFunctionbigMux
()
mux_test.go:960
↓ 2 callersFunctioncontentEncoding
Check the content encoding against a list of acceptable values.
middleware/content_charset.go:29
↓ 2 callersMethodfindEdge
(ntyp nodeTyp, label byte)
tree.go:559
↓ 2 callersMethodfindPattern
(pattern string)
tree.go:591
↓ 2 callersMethodisLeaf
()
tree.go:587
next →1–100 of 435, ranked by callers