Fixing raw file fetch method

This commit is contained in:
Ricardo Baptista
2019-09-11 12:11:30 -03:00
parent 621ff29cd2
commit ad67345b1f
3 changed files with 21 additions and 5 deletions

View File

@ -5,6 +5,7 @@
package bitbucketv1
import (
"io/ioutil"
"encoding/json"
"net/http"
"strings"
@ -365,3 +366,14 @@ func NewBitbucketAPIResponse(r *http.Response) (*APIResponse, error) {
}
return response, err
}
func NewRawAPIResponse(r *http.Response) (*APIResponse, error) {
response := &APIResponse{Response: r}
raw, err := ioutil.ReadAll(r.Body)
if err != nil {
return nil, err
}
response.Payload = raw
return response, nil
}