Updating dependencies. (#11680)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f226f672f3
Коммит
20825a1702
20
vendor/github.com/gorilla/handlers/.travis.yml
сгенерированный
поставляемый
20
vendor/github.com/gorilla/handlers/.travis.yml
сгенерированный
поставляемый
@@ -1,20 +0,0 @@
|
||||
language: go
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- go: 1.4
|
||||
- go: 1.5
|
||||
- go: 1.6
|
||||
- go: 1.7
|
||||
- go: 1.8
|
||||
- go: tip
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- diff -u <(echo -n) <(gofmt -d .)
|
||||
- go vet $(go list ./... | grep -v /vendor/)
|
||||
- go test -v -race ./...
|
||||
|
||||
2
vendor/github.com/gorilla/handlers/README.md
сгенерированный
поставляемый
2
vendor/github.com/gorilla/handlers/README.md
сгенерированный
поставляемый
@@ -25,7 +25,7 @@ with Go's `net/http` package (or any framework supporting `http.Handler`), inclu
|
||||
* [**RecoveryHandler**](https://godoc.org/github.com/gorilla/handlers#RecoveryHandler) for recovering from unexpected panics.
|
||||
|
||||
Other handlers are documented [on the Gorilla
|
||||
website](http://www.gorillatoolkit.org/pkg/handlers).
|
||||
website](https://www.gorillatoolkit.org/pkg/handlers).
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
29
vendor/github.com/gorilla/handlers/cors.go
сгенерированный
поставляемый
29
vendor/github.com/gorilla/handlers/cors.go
сгенерированный
поставляемый
@@ -19,14 +19,16 @@ type cors struct {
|
||||
maxAge int
|
||||
ignoreOptions bool
|
||||
allowCredentials bool
|
||||
optionStatusCode int
|
||||
}
|
||||
|
||||
// OriginValidator takes an origin string and returns whether or not that origin is allowed.
|
||||
type OriginValidator func(string) bool
|
||||
|
||||
var (
|
||||
defaultCorsMethods = []string{"GET", "HEAD", "POST"}
|
||||
defaultCorsHeaders = []string{"Accept", "Accept-Language", "Content-Language", "Origin"}
|
||||
defaultCorsOptionStatusCode = 200
|
||||
defaultCorsMethods = []string{"GET", "HEAD", "POST"}
|
||||
defaultCorsHeaders = []string{"Accept", "Accept-Language", "Content-Language", "Origin"}
|
||||
// (WebKit/Safari v9 sends the Origin header by default in AJAX requests)
|
||||
)
|
||||
|
||||
@@ -130,6 +132,7 @@ func (ch *cors) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set(corsAllowOriginHeader, returnOrigin)
|
||||
|
||||
if r.Method == corsOptionMethod {
|
||||
w.WriteHeader(ch.optionStatusCode)
|
||||
return
|
||||
}
|
||||
ch.h.ServeHTTP(w, r)
|
||||
@@ -164,9 +167,10 @@ func CORS(opts ...CORSOption) func(http.Handler) http.Handler {
|
||||
|
||||
func parseCORSOptions(opts ...CORSOption) *cors {
|
||||
ch := &cors{
|
||||
allowedMethods: defaultCorsMethods,
|
||||
allowedHeaders: defaultCorsHeaders,
|
||||
allowedOrigins: []string{},
|
||||
allowedMethods: defaultCorsMethods,
|
||||
allowedHeaders: defaultCorsHeaders,
|
||||
allowedOrigins: []string{},
|
||||
optionStatusCode: defaultCorsOptionStatusCode,
|
||||
}
|
||||
|
||||
for _, option := range opts {
|
||||
@@ -251,7 +255,20 @@ func AllowedOriginValidator(fn OriginValidator) CORSOption {
|
||||
}
|
||||
}
|
||||
|
||||
// ExposeHeaders can be used to specify headers that are available
|
||||
// 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 mandatory
|
||||
// and can be used if you need a custom status code (i.e 204).
|
||||
//
|
||||
// More informations on the spec:
|
||||
// https://fetch.spec.whatwg.org/#cors-preflight-fetch
|
||||
func OptionStatusCode(code int) CORSOption {
|
||||
return func(ch *cors) error {
|
||||
ch.optionStatusCode = code
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExposedHeaders can be used to specify headers that are available
|
||||
// and will not be stripped out by the user-agent.
|
||||
func ExposedHeaders(headers []string) CORSOption {
|
||||
return func(ch *cors) error {
|
||||
|
||||
1
vendor/github.com/gorilla/handlers/go.mod
сгенерированный
поставляемый
Обычный файл
1
vendor/github.com/gorilla/handlers/go.mod
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1 @@
|
||||
module github.com/gorilla/handlers
|
||||
8
vendor/github.com/gorilla/handlers/handlers_go18.go
сгенерированный
поставляемый
8
vendor/github.com/gorilla/handlers/handlers_go18.go
сгенерированный
поставляемый
@@ -19,3 +19,11 @@ func (l *responseLogger) Push(target string, opts *http.PushOptions) error {
|
||||
}
|
||||
return p.Push(target, opts)
|
||||
}
|
||||
|
||||
func (c *compressResponseWriter) Push(target string, opts *http.PushOptions) error {
|
||||
p, ok := c.ResponseWriter.(http.Pusher)
|
||||
if !ok {
|
||||
return fmt.Errorf("compressResponseWriter does not implement http.Pusher")
|
||||
}
|
||||
return p.Push(target, opts)
|
||||
}
|
||||
|
||||
2
vendor/github.com/gorilla/handlers/logging.go
сгенерированный
поставляемый
2
vendor/github.com/gorilla/handlers/logging.go
сгенерированный
поставляемый
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
// Logging
|
||||
|
||||
// FormatterParams is the structure any formatter will be handed when time to log comes
|
||||
// LogFormatterParams is the structure any formatter will be handed when time to log comes
|
||||
type LogFormatterParams struct {
|
||||
Request *http.Request
|
||||
URL url.URL
|
||||
|
||||
Ссылка в новой задаче
Block a user