Skip to content

Commit a312b05

Browse files
Remove unneeded v2 method "CheckStatus" (#499)
1 parent 03943a5 commit a312b05

File tree

4 files changed

+0
-32
lines changed

4 files changed

+0
-32
lines changed

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/go-driver/tree/master) (N/A)
4-
- [V2] add Response.CheckStatus
54
- Add ErrArangoDatabaseNotFound and IsExternalStorageError helper to v2
65
- [V2] Support for Collection Documents removal
76
- [V2] Fix: Plain Connection doesn't work with JWT authentication

v2/connection/connection.go

-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ type Request interface {
6969
type Response interface {
7070
// Code returns an HTTP compatible status code of the response.
7171
Code() int
72-
// CheckStatus checks if the status of the response equals to one of the given status codes.
73-
// If so, nil is returned.
74-
// If not, an attempt is made to parse an error response in the body and an error is returned.
75-
CheckStatus(validStatusCodes ...int) error
7672
// Response returns underlying response object
7773
Response() interface{}
7874
// Endpoint returns the endpoint that handled the request.

v2/connection/connection_http_response.go

-10
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ func (j *httpResponse) Response() interface{} {
3838
return j.response
3939
}
4040

41-
func (j *httpResponse) CheckStatus(validStatusCodes ...int) error {
42-
for _, x := range validStatusCodes {
43-
if x == j.response.StatusCode {
44-
// Found valid status code
45-
return nil
46-
}
47-
}
48-
return NewError(j.response.StatusCode, "Unexpected status code")
49-
}
50-
5141
func (j *httpResponse) Code() int {
5242
return j.response.StatusCode
5343
}

v2/connection/connection_http_response_test.go

-17
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"testing"
2626

2727
"github.com/stretchr/testify/assert"
28-
"github.com/stretchr/testify/require"
2928
)
3029

3130
func Test_httpResponse_Content(t *testing.T) {
@@ -73,19 +72,3 @@ func Test_httpResponse_Content(t *testing.T) {
7372
assert.Equal(t, "", j.Content())
7473
})
7574
}
76-
77-
func Test_httpResponse_CheckStatus(t *testing.T) {
78-
j := httpResponse{
79-
response: &http.Response{
80-
StatusCode: http.StatusOK,
81-
},
82-
}
83-
84-
t.Run("code expected", func(t *testing.T) {
85-
require.NoError(t, j.CheckStatus(http.StatusOK))
86-
})
87-
88-
t.Run("code not expected", func(t *testing.T) {
89-
require.Error(t, j.CheckStatus(http.StatusConflict, http.StatusInternalServerError))
90-
})
91-
}

0 commit comments

Comments
 (0)