blob: 1a6c44ad5ed9737bc005731587b19523dfb1e5a7 [file] [log] [blame]
Jon Perritt4a59d232014-10-09 20:21:31 -05001package v1
2
3import (
4 "net/http"
5)
6
7// CommonResult is a structure that contains the response and error of a call to an
8// object storage endpoint.
9type CommonResult struct {
10 Resp *http.Response
11 Err error
12}
13
14// ExtractHeaders will extract and return the headers from a *http.Response.
15func (cr CommonResult) ExtractHeaders() (http.Header, error) {
16 if cr.Err != nil {
17 return nil, cr.Err
18 }
19
20 var headers http.Header
21 if cr.Err != nil {
22 return headers, cr.Err
23 }
24 return cr.Resp.Header, nil
25}