mirror of https://github.com/docker/docs.git
Merge pull request #8905 from 13W/x-registry-auth
allow to use x-registry-auth header with enabled cors
This commit is contained in:
commit
f676891192
|
@ -1181,7 +1181,7 @@ func optionsHandler(eng *engine.Engine, version version.Version, w http.Response
|
||||||
}
|
}
|
||||||
func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
|
func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Add("Access-Control-Allow-Origin", "*")
|
w.Header().Add("Access-Control-Allow-Origin", "*")
|
||||||
w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
|
w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
|
||||||
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
|
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -785,8 +785,8 @@ func TestGetEnabledCors(t *testing.T) {
|
||||||
if allowOrigin != "*" {
|
if allowOrigin != "*" {
|
||||||
t.Errorf("Expected header Access-Control-Allow-Origin to be \"*\", %s found.", allowOrigin)
|
t.Errorf("Expected header Access-Control-Allow-Origin to be \"*\", %s found.", allowOrigin)
|
||||||
}
|
}
|
||||||
if allowHeaders != "Origin, X-Requested-With, Content-Type, Accept" {
|
if allowHeaders != "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth" {
|
||||||
t.Errorf("Expected header Access-Control-Allow-Headers to be \"Origin, X-Requested-With, Content-Type, Accept\", %s found.", allowHeaders)
|
t.Errorf("Expected header Access-Control-Allow-Headers to be \"Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth\", %s found.", allowHeaders)
|
||||||
}
|
}
|
||||||
if allowMethods != "GET, POST, DELETE, PUT, OPTIONS" {
|
if allowMethods != "GET, POST, DELETE, PUT, OPTIONS" {
|
||||||
t.Errorf("Expected hearder Access-Control-Allow-Methods to be \"GET, POST, DELETE, PUT, OPTIONS\", %s found.", allowMethods)
|
t.Errorf("Expected hearder Access-Control-Allow-Methods to be \"GET, POST, DELETE, PUT, OPTIONS\", %s found.", allowMethods)
|
||||||
|
|
Loading…
Reference in New Issue