Test Activity's Content-Type format.

This commit is contained in:
Naoki Kosaka 2019-06-02 16:44:54 +09:00
parent 1654523083
commit e3d5bec579

View File

@ -26,7 +26,7 @@ func TestMain(m *testing.M) {
func TestRelayActivity(t *testing.T) { func TestRelayActivity(t *testing.T) {
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
data, _ := ioutil.ReadAll(r.Body) data, _ := ioutil.ReadAll(r.Body)
if string(data) != "data" { if string(data) != "data" || r.Header.Get("Content-Type") != "application/activity+json" {
w.WriteHeader(500) w.WriteHeader(500)
w.Write(nil) w.Write(nil)
} else { } else {
@ -80,7 +80,7 @@ func TestRelayActivityResp500(t *testing.T) {
func TestRegistorActivity(t *testing.T) { func TestRegistorActivity(t *testing.T) {
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
data, _ := ioutil.ReadAll(r.Body) data, _ := ioutil.ReadAll(r.Body)
if string(data) != "data" { if string(data) != "data" || r.Header.Get("Content-Type") != "application/activity+json" {
w.WriteHeader(500) w.WriteHeader(500)
w.Write(nil) w.Write(nil)
} else { } else {