Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handlers: Add "X-Attribute-*" header for OPTIONS upload #188

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions handlers/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
)

const (
allOrigins = "*"
allowHeaders = "X-Bearer-For-All-Users, X-Bearer-Lifetime, X-Bearer-Owner-Id, X-Bearer-Signature, X-Bearer-Signature-Key, Content-Type, Authorization"
allOrigins = "*"
allowHeaders = "X-Bearer-For-All-Users, X-Bearer-Lifetime, X-Bearer-Owner-Id, X-Bearer-Signature, X-Bearer-Signature-Key, Content-Type, Authorization"
allowUploadHeader = "*"

methodGet = "GET"
methodHead = "HEAD"
Expand Down Expand Up @@ -112,7 +113,7 @@
// OptionsUploadContainerObject handler for the uploadContainerObject options request.
func (a *RestAPI) OptionsUploadContainerObject(ctx echo.Context, _ apiserver.ContainerId) error {
ctx.Response().Header().Set(accessControlAllowOriginHeader, allOrigins)
ctx.Response().Header().Set(accessControlAllowHeadersHeader, allowHeaders)
ctx.Response().Header().Set(accessControlAllowHeadersHeader, allowUploadHeader)

Check warning on line 116 in handlers/preflight.go

View check run for this annotation

Codecov / codecov/patch

handlers/preflight.go#L116

Added line #L116 was not covered by tests
ctx.Response().Header().Set(accessControlAllowMethodsHeader, allowMethods(methodPost))
return ctx.NoContent(http.StatusOK)
}
Expand Down
Loading