Skip to content

Commit

Permalink
added HEAD to quickly take headers for example ETag (#265)
Browse files Browse the repository at this point in the history
Co-authored-by: Maksim Kovshov <[email protected]>
  • Loading branch information
Muyk33rus and Maksim Kovshov authored Jul 24, 2023
1 parent 574838f commit 6e8a290
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,21 @@ func (c *APIClient) GetSession() (*Session, error) {
}, nil
}

// Get performs a HEAD request against the Redfish service.
func (c *APIClient) Head(url string) (*http.Response, error) {
return c.HeadWithHeaders(url, nil)
}

// GetWithHeaders performs a HEAD request against the Redfish service but allowing custom headers
func (c *APIClient) HeadWithHeaders(url string, customHeaders map[string]string) (*http.Response, error) {
relativePath := url
if relativePath == "" {
relativePath = common.DefaultServiceRoot
}

return c.runRequestWithHeaders(http.MethodHead, relativePath, nil, customHeaders)
}

// Get performs a GET request against the Redfish service.
func (c *APIClient) Get(url string) (*http.Response, error) {
return c.GetWithHeaders(url, nil)
Expand Down

0 comments on commit 6e8a290

Please sign in to comment.