Skip to content

Commit

Permalink
Add Expires to PutObject opts (#1900)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadmeste committed Nov 19, 2023
1 parent e0b6838 commit 6eebdd6
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
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.21.0 ]
go-version: [ 1.21.4 ]
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
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 6eebdd6

Please sign in to comment.