allow to use x-registry-auth header with enabled cors
| ... | ... |
@@ -1181,7 +1181,7 @@ func optionsHandler(eng *engine.Engine, version version.Version, w http.Response |
| 1181 | 1181 |
} |
| 1182 | 1182 |
func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
|
| 1183 | 1183 |
w.Header().Add("Access-Control-Allow-Origin", "*")
|
| 1184 |
- w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
|
|
| 1184 |
+ w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
|
|
| 1185 | 1185 |
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
|
| 1186 | 1186 |
} |
| 1187 | 1187 |
|
| ... | ... |
@@ -785,8 +785,8 @@ func TestGetEnabledCors(t *testing.T) {
|
| 785 | 785 |
if allowOrigin != "*" {
|
| 786 | 786 |
t.Errorf("Expected header Access-Control-Allow-Origin to be \"*\", %s found.", allowOrigin)
|
| 787 | 787 |
} |
| 788 |
- if allowHeaders != "Origin, X-Requested-With, Content-Type, Accept" {
|
|
| 789 |
- t.Errorf("Expected header Access-Control-Allow-Headers to be \"Origin, X-Requested-With, Content-Type, Accept\", %s found.", allowHeaders)
|
|
| 788 |
+ if allowHeaders != "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth" {
|
|
| 789 |
+ t.Errorf("Expected header Access-Control-Allow-Headers to be \"Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth\", %s found.", allowHeaders)
|
|
| 790 | 790 |
} |
| 791 | 791 |
if allowMethods != "GET, POST, DELETE, PUT, OPTIONS" {
|
| 792 | 792 |
t.Errorf("Expected hearder Access-Control-Allow-Methods to be \"GET, POST, DELETE, PUT, OPTIONS\", %s found.", allowMethods)
|