Skip to content

Commit

Permalink
refactor: adjust http error
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Dec 11, 2018
1 parent fe3cd7e commit 48e9b6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
type (
// HTTPError http error
HTTPError struct {
StatusCode int `json:"status_code,omitempty"`
StatusCode int `json:"statusCode,omitempty"`
Code string `json:"code,omitempty"`
Category string `json:"category,omitempty"`
Message string `json:"message,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions middleware/responder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestResponder(t *testing.T) {
})
resp := httptest.NewRecorder()
d.ServeHTTP(resp, req)
checkResponse(t, resp, 500, `{"status_code":500,"category":"cod","message":"invalid response"}`)
checkResponse(t, resp, 500, `{"statusCode":500,"category":"cod","message":"invalid response"}`)
checkJSON(t, resp)
})

Expand All @@ -51,7 +51,7 @@ func TestResponder(t *testing.T) {
})
resp := httptest.NewRecorder()
d.ServeHTTP(resp, req)
checkResponse(t, resp, 500, `{"status_code":500,"message":"abc"}`)
checkResponse(t, resp, 500, `{"statusCode":500,"message":"abc"}`)
checkJSON(t, resp)
})

Expand All @@ -67,7 +67,7 @@ func TestResponder(t *testing.T) {
})
resp := httptest.NewRecorder()
d.ServeHTTP(resp, req)
checkResponse(t, resp, 400, `{"status_code":400,"category":"custom","message":"abc"}`)
checkResponse(t, resp, 400, `{"statusCode":400,"category":"custom","message":"abc"}`)
checkJSON(t, resp)
})

Expand Down

0 comments on commit 48e9b6a

Please sign in to comment.