mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
update test for respond func
This commit is contained in:
parent
734d32082a
commit
5507fbcd92
@ -2,17 +2,22 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRespond(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
respond(w, 15)
|
||||
respond(w, http.StatusOK, 15)
|
||||
|
||||
if w.Code != 200 {
|
||||
t.Errorf("Invalid response code")
|
||||
}
|
||||
|
||||
// assert json header
|
||||
if w.Header().Get("Content-Type") != "application/json" {
|
||||
t.Errorf("Invalid Content-Type header")
|
||||
t.Errorf("Invalid response header for Content-Type")
|
||||
}
|
||||
|
||||
// assert json response
|
||||
|
Loading…
x
Reference in New Issue
Block a user