Skip to content

Commit

Permalink
Add Expires to PutObject opts
Browse files Browse the repository at this point in the history
  • Loading branch information
Anis Elleuch committed Nov 19, 2023
1 parent e0b6838 commit f9ca58b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.21.0 ]
go-version: [ 1.21.x ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions api-put-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type PutObjectOptions struct {
ContentDisposition string
ContentLanguage string
CacheControl string
Expires time.Time
Mode RetentionMode
RetainUntilDate time.Time
ServerSideEncryption encrypt.ServerSide
Expand Down Expand Up @@ -153,6 +154,10 @@ func (opts PutObjectOptions) Header() (header http.Header) {
header.Set("Cache-Control", opts.CacheControl)
}

if !opts.Expires.IsZero() {
header.Set("Expires", opts.Expires.UTC().Format(http.TimeFormat))
}

if opts.Mode != "" {
header.Set(amzLockMode, opts.Mode.String())
}
Expand Down

0 comments on commit f9ca58b

Please sign in to comment.