summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDmitry Patsura <[email protected]>2019-06-20 16:29:48 +0300
committerDmitry Patsura <[email protected]>2019-06-20 16:29:48 +0300
commit3b16dd837a203fc4865e94a031b64a83080e12ef (patch)
tree93838ae9f56525983980a3f76ab60febfdfcf3d7 /service
parentcf02521e1473ea099927e8fff1f0702f2418221d (diff)
Feature(http): Cors - support exposedHeaders option
Diffstat (limited to 'service')
-rw-r--r--service/http/config.go1
-rw-r--r--service/http/service.go4
2 files changed, 5 insertions, 0 deletions
diff --git a/service/http/config.go b/service/http/config.go
index 2897d1f7..e2f42626 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -50,6 +50,7 @@ type CORSMiddlewareConfig struct {
AllowedMethods string
AllowedHeaders string
AllowCredentials *bool
+ ExposedHeaders string
MaxAge int
}
diff --git a/service/http/service.go b/service/http/service.go
index 527aca1b..f394f6af 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -315,6 +315,10 @@ func addCORSHeaders(w http.ResponseWriter, r *http.Request, options *CORSMiddlew
headers.Set("Access-Control-Allow-Headers", options.AllowedHeaders)
}
+ if options.ExposedHeaders != "" {
+ headers.Set("Access-Control-Expose-Headers", options.ExposedHeaders)
+ }
+
if options.AllowCredentials != nil {
headers.Set("Access-Control-Allow-Credentials", strconv.FormatBool(*options.AllowCredentials))
}