Skip to content

Allow extra headers of HEAD request for container/object requests. #178

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ type Connection struct {
// Workarounds for non-compliant servers that don't always return opts.Limit items per page
FetchUntilEmptyPage bool // Always fetch unless we received an empty page
PartialPageFetchThreshold int // Fetch if the current page is this percentage of opts.Limit
// Extra Headers for Continer HEAD reqeust
ExtraHeadersForContinerHEAD Headers `json:"-" xml:"-"`
// Extra Headers for Object HEAD reqeust
ExtraHeadersForObjectHEAD Headers `json:"-" xml:"-"`
}

// setFromEnv reads the value that param points to (it must be a
Expand Down Expand Up @@ -1335,6 +1339,7 @@ func (c *Connection) Container(ctx context.Context, container string) (info Cont
Operation: "HEAD",
ErrorMap: ContainerErrorMap,
NoResponse: true,
Headers: c.ExtraHeadersForContinerHEAD,
})
if err != nil {
return
Expand Down Expand Up @@ -2126,6 +2131,7 @@ func (c *Connection) objectBase(ctx context.Context, container string, objectNam
Operation: "HEAD",
ErrorMap: objectErrorMap,
NoResponse: true,
Headers: c.ExtraHeadersForObjectHEAD,
})
if err != nil {
return
Expand Down