Skip to content

Commit

Permalink
Include requestURI in error text
Browse files Browse the repository at this point in the history
  • Loading branch information
loafoe committed Feb 3, 2023
1 parent edc21bd commit a79eed9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dicom/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,5 @@ func TestErrorResponse(t *testing.T) {
return
}
assert.Equal(t, http.StatusConflict, resp.StatusCode())
assert.Equal(t, err.Error(), `POST : StatusCode 409, Body: {"error":"something unexpected happened"}`)
assert.Equal(t, err.Error(), `POST /store/dicom/config/dicom/production/remoteNodes: StatusCode 409, Body: {"error":"something unexpected happened"}`)
}
6 changes: 5 additions & 1 deletion internal/check_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ func CheckResponse(r *http.Response) error {
data = []byte("empty")
}
r.Body = io.NopCloser(bytes.NewBuffer(data)) // Preserve body
return fmt.Errorf("%s %s: StatusCode %d, Body: %s", r.Request.Method, r.Request.RequestURI, r.StatusCode, string(data))
requestURI := ""
if r.Request.URL != nil {
requestURI = r.Request.URL.RequestURI()
}
return fmt.Errorf("%s %s: StatusCode %d, Body: %s", r.Request.Method, requestURI, r.StatusCode, string(data))
}
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package internal

const (
LibraryVersion = "0.77.7"
LibraryVersion = "0.77.8"
)

0 comments on commit a79eed9

Please sign in to comment.