Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/gorilla/handlers
/ functions
Functions
125 in github.com/gorilla/handlers
⨍
Functions
125
◇
Types & classes
17
↓ 43 callers
Method
ServeHTTP
(w http.ResponseWriter, r *http.Request)
cors.go:50
↓ 42 callers
Function
newRequest
(method, url string)
handlers_test.go:29
↓ 21 callers
Function
CORS
CORS provides Cross-Origin Resource Sharing middleware. Example: import ( "net/http" "github.com/gorilla/handlers" "github.com/goril
cors.go:157
↓ 20 callers
Method
Header
()
compress_test.go:273
↓ 11 callers
Method
WriteHeader
(s int)
handlers.go:60
↓ 7 callers
Method
isMatch
(needle string, haystack []string)
cors.go:344
↓ 5 callers
Function
CanonicalHost
CanonicalHost is HTTP middleware that re-directs requests to the canonical domain. It accepts a domain and a status code (e.g. 301 or 302) and re-dire
canonical.go:29
↓ 5 callers
Function
CompressHandler
CompressHandler gzip compresses HTTP responses for clients that support it via the 'Accept-Encoding' header. Compressing TLS traffic may leak the pag
compress.go:63
↓ 5 callers
Method
Status
()
handlers.go:65
↓ 4 callers
Method
Println
(...interface{})
recovery.go:11
↓ 4 callers
Method
Write
(b []byte)
handlers.go:54
↓ 4 callers
Function
compressedRequest
(w *httptest.ResponseRecorder, compression string)
compress_test.go:25
↓ 4 callers
Function
constructTypicalRequestOk
A typical request with an OK response.
logging_test.go:350
↓ 3 callers
Function
AllowedOrigins
AllowedOrigins sets the allowed origins for CORS requests, as used in the 'Allow-Access-Control-Origin' HTTP header. Note: Passing in a []string{"*"}
cors.go:232
↓ 3 callers
Method
Flush
()
compress.go:44
↓ 3 callers
Function
RecoveryHandler
RecoveryHandler is HTTP middleware that recovers from a panic, logs the panic, writes http.StatusInternalServerError, and continues to the next handle
recovery.go:45
↓ 3 callers
Method
ServeHTTP
(w http.ResponseWriter, req *http.Request)
handlers.go:28
↓ 3 callers
Method
Size
()
handlers.go:69
↓ 3 callers
Function
appendQuoted
(buf []byte, s string)
logging.go:80
↓ 2 callers
Function
AllowedMethods
AllowedMethods can be used to explicitly allow methods in the Access-Control-Allow-Methods header. This is a replacement operation so you must also pa
cors.go:211
↓ 2 callers
Function
AllowedOriginValidator
AllowedOriginValidator sets a function for evaluating allowed origins in CORS requests, represented by the 'Allow-Access-Control-Origin' HTTP header.
cors.go:248
↓ 2 callers
Function
LoggingHandler
LoggingHandler return a http.Handler that wraps h and logs requests to out in Apache Common Log Format (CLF). See http://httpd.apache.org/docs/2.2/lo
logging.go:238
↓ 2 callers
Function
LoggingScenario1
(t *testing.T, formatter LogFormatter, expected string)
logging_test.go:216
↓ 2 callers
Function
LoggingScenario2
(t *testing.T, formatter LogFormatter, expected string)
logging_test.go:243
↓ 2 callers
Function
LoggingScenario3
(t *testing.T, formatter LogFormatter, expected string)
logging_test.go:269
↓ 2 callers
Function
PrintRecoveryStack
PrintRecoveryStack is a functional option to enable or disable printing stack traces on panic.
recovery.go:64
↓ 2 callers
Function
RecoveryLogger
RecoveryLogger is a functional option to override the default logger.
recovery.go:54
↓ 2 callers
Function
buildCommonLogLine
buildCommonLogLine builds a log entry for req in Apache Common Log Format. ts is the timestamp with which the entry should be logged. status and size
logging.go:147
↓ 2 callers
Function
cleanHost
cleanHost cleans invalid Host headers by stripping anything after '/' or ' '. This is backported from Go 1.5 (in response to issue #11206) and attempt
canonical.go:68
↓ 2 callers
Function
getIP
getIP retrieves the IP from the X-Forwarded-For, X-Real-IP and RFC7239 Forwarded headers (in that order).
proxy_headers.go:67
↓ 2 callers
Function
getScheme
getScheme retrieves the scheme from the X-Forwarded-Proto and RFC7239 Forwarded headers (in that order).
proxy_headers.go:101
↓ 2 callers
Function
makeLogger
(w http.ResponseWriter)
logging.go:66
↓ 1 callers
Function
AllowCredentials
AllowCredentials can be used to specify that the user agent may pass authentication details along with the request.
cors.go:315
↓ 1 callers
Function
AllowedHeaders
Functional options for configuring CORS. AllowedHeaders adds the provided headers to the list of allowed headers in a CORS request. This is an appen
cors.go:190
↓ 1 callers
Function
CompressHandlerLevel
CompressHandlerLevel gzip compresses HTTP responses with specified compression level for clients that support it via the 'Accept-Encoding' header. Th
compress.go:73
↓ 1 callers
Function
ContentTypeHandler
ContentTypeHandler wraps and returns a http.Handler, validating the request content type is compatible with the contentTypes list. It writes a HTTP 41
handlers.go:98
↓ 1 callers
Function
ExposedHeaders
ExposedHeaders can be used to specify headers that are available and will not be stripped out by the user-agent.
cors.go:270
↓ 1 callers
Function
HTTPMethodOverrideHandler
HTTPMethodOverrideHandler wraps and returns a http.Handler which checks for the X-HTTP-Method-Override header or the _method form key, and overrides (
handlers.go:137
↓ 1 callers
Function
IgnoreOptions
IgnoreOptions causes the CORS middleware to ignore OPTIONS requests, instead passing them through to the next handler. This is useful when your applic
cors.go:306
↓ 1 callers
Function
LoggingScenario4
(t *testing.T, formatter LogFormatter, expected string)
logging_test.go:296
↓ 1 callers
Function
LoggingScenario5
(t *testing.T, formatter LogFormatter, expected string)
logging_test.go:322
↓ 1 callers
Function
MaxAge
MaxAge determines the maximum age (in seconds) between preflight requests. A maximum of 10 minutes is allowed. An age above this value will default to
cors.go:291
↓ 1 callers
Function
OptionStatusCode
OptionStatusCode sets a custom status code on the OPTIONS requests. Default behaviour sets it to 200 to reflect best practices. This is option is not
cors.go:261
↓ 1 callers
Function
ProxyHeaders
ProxyHeaders inspects common reverse proxy headers and sets the corresponding fields in the HTTP request struct. These are X-Forwarded-For and X-Real-
proxy_headers.go:43
↓ 1 callers
Function
constructConnectRequest
CONNECT request over http/2.0.
logging_test.go:363
↓ 1 callers
Function
constructEncodedRequest
()
logging_test.go:383
↓ 1 callers
Function
isContentType
isContentType validates the Content-Type header matches the supplied contentType. That is, its type and subtype match.
handlers.go:85
↓ 1 callers
Method
isOriginAllowed
(origin string)
cors.go:322
↓ 1 callers
Method
log
(v ...interface{})
recovery.go:83
↓ 1 callers
Function
parseCORSOptions
(opts ...CORSOption)
cors.go:165
↓ 1 callers
Function
parseRecoveryOptions
(h http.Handler, opts ...RecoveryOption)
recovery.go:25
↓ 1 callers
Function
writeLog
writeLog writes a log entry for req to w in Apache Common Log Format. ts is the timestamp with which the entry should be logged. status and size are u
logging.go:194
Function
BenchmarkWriteLog
(b *testing.B)
logging_test.go:132
Function
CombinedLoggingHandler
CombinedLoggingHandler return a http.Handler that wraps h and logs requests to out in Apache Combined Log Format. See http://httpd.apache.org/docs/2.
logging.go:219
Function
CustomLoggingHandler
CustomLoggingHandler provides a way to supply a custom log formatter while taking advantage of the mechanisms in this package.
logging.go:244
Method
Flush
Flush implements the http.Flusher interface.
compress_test.go:235
Method
Flush
()
compress.go:47
Method
Header
Header/Write/WriteHeader implement the http.ResponseWriter interface.
compress_test.go:225
Method
Hijack
Hijack implements the http.Hijacker interface.
compress_test.go:238
Method
Hijack
()
handlers.go:73
Method
ReadFrom
(r io.Reader)
compress.go:39
Method
ServeHTTP
(w http.ResponseWriter, req *http.Request)
recovery.go:72
Method
ServeHTTP
(w http.ResponseWriter, req *http.Request)
logging.go:42
Method
ServeHTTP
(w http.ResponseWriter, r *http.Request)
canonical.go:37
Function
TestAcceptEncodingIsDropped
(t *testing.T)
compress_test.go:64
Function
TestBadDomain
(t *testing.T)
canonical_test.go:67
Function
TestCORSAllowStar
(t *testing.T)
cors_test.go:407
Function
TestCORSHandlerAllowMethodsNotSetForSimpleRequestPreflight
(t *testing.T)
cors_test.go:189
Function
TestCORSHandlerAllowedCredentials
(t *testing.T)
cors_test.go:301
Function
TestCORSHandlerAllowedHeaderForPreflight
(t *testing.T)
cors_test.go:238
Function
TestCORSHandlerAllowedHeaderNotSetForSimpleRequestPreflight
(t *testing.T)
cors_test.go:213
Function
TestCORSHandlerAllowedMethodForPreflight
(t *testing.T)
cors_test.go:167
Function
TestCORSHandlerIgnoreOptionsFallsThrough
(t *testing.T)
cors_test.go:38
Function
TestCORSHandlerInvalidHeaderForPreflightForbidden
(t *testing.T)
cors_test.go:261
Function
TestCORSHandlerInvalidRequestMethodForPreflightMethodNotAllowed
(t *testing.T)
cors_test.go:92
Function
TestCORSHandlerMaxAgeForPreflight
(t *testing.T)
cors_test.go:279
Function
TestCORSHandlerMultipleAllowOriginsSetsVaryHeader
(t *testing.T)
cors_test.go:322
Function
TestCORSHandlerOptionsRequestMustNotBePassedToNextHandler
(t *testing.T)
cors_test.go:109
Function
TestCORSHandlerOptionsRequestMustNotBePassedToNextHandlerWhenOriginNotAllowed
(t *testing.T)
cors_test.go:148
Function
TestCORSHandlerOptionsRequestMustNotBePassedToNextHandlerWithCustomStatusCode
(t *testing.T)
cors_test.go:128
Function
TestCORSHandlerSetsExposedHeaders
(t *testing.T)
cors_test.go:56
Function
TestCORSHandlerUnsetRequestMethodForPreflightBadRequest
(t *testing.T)
cors_test.go:77
Function
TestCORSOriginValidatorWithExplicitStar
(t *testing.T)
cors_test.go:385
Function
TestCORSOriginValidatorWithImplicitStar
(t *testing.T)
cors_test.go:366
Function
TestCORSWithMultipleHandlers
(t *testing.T)
cors_test.go:343
Function
TestCanonicalHost
(t *testing.T)
canonical_test.go:31
Function
TestCleanHost
(t *testing.T)
canonical_test.go:14
Function
TestCompressFile
Make sure we can compress and serve an *os.File properly. We need to use a real http server to trigger the net/http sendfile special case.
compress_test.go:177
Function
TestCompressHandlerDeflate
(t *testing.T)
compress_test.go:147
Function
TestCompressHandlerDoesntInventInterfaces
(t *testing.T)
compress_test.go:282
Function
TestCompressHandlerGzip
(t *testing.T)
compress_test.go:129
Function
TestCompressHandlerGzipDeflate
(t *testing.T)
compress_test.go:162
Function
TestCompressHandlerNoCompression
(t *testing.T)
compress_test.go:43
Function
TestCompressHandlerPreserveInterfaces
(t *testing.T)
compress_test.go:242
Function
TestContentTypeHandler
(t *testing.T)
handlers_test.go:84
Function
TestDefaultCORSHandlerReturnsOk
(t *testing.T)
cors_test.go:10
Function
TestDefaultCORSHandlerReturnsOkWithOrigin
(t *testing.T)
cors_test.go:23
Function
TestEmptyHost
(t *testing.T)
canonical_test.go:81
Function
TestGetIP
(t *testing.T)
proxy_headers_test.go:15
Function
TestGetScheme
(t *testing.T)
proxy_headers_test.go:46
next →
1–100 of 125, ranked by callers