Skip to content

Commit cd535ea

Browse files
committed
added httperr.NewFromResponse
1 parent 5e4cf2e commit cd535ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

httperr/response.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ func Errorf(statusCode int, format string, a ...interface{}) Response {
3232
}
3333
}
3434

35+
func NewFromResponse(resonse *http.Response) Response {
36+
return statusCodeAndText{
37+
statusCode: resonse.StatusCode,
38+
statusText: resonse.Status,
39+
}
40+
}
41+
3542
func (e statusCodeAndText) Error() string {
3643
if e.statusText == "" {
3744
return http.StatusText(e.statusCode)

0 commit comments

Comments
 (0)