1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-22 04:17:03 +00:00

fix #2158 and more

This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-07-08 02:08:18 +03:00
parent 757e7fe61b
commit 6add1ba49b
79 changed files with 551 additions and 467 deletions

View File

@@ -20,31 +20,31 @@ func TestReadBodyAndNegotiate(t *testing.T) {
// Test send JSON and receive JSON.
e.POST("/").WithJSON(expectedPayload).Expect().Status(httptest.StatusOK).
JSON().Equal(expectedPayload)
JSON().IsEqual(expectedPayload)
// Test send Form and receive XML.
e.POST("/").WithForm(expectedPayload).
WithHeader("Accept", "application/xml").
Expect().Status(httptest.StatusOK).
Body().Equal(expectedXMLPayload)
Body().IsEqual(expectedXMLPayload)
// Test send URL Query and receive MessagePack.
e.POST("/").WithQuery("message", expectedPayload.Message).
WithHeader("Accept", "application/msgpack").
Expect().Status(httptest.StatusOK).ContentType("application/msgpack").
Body().Equal(expectedMsgPackPayload)
Body().IsEqual(expectedMsgPackPayload)
// Test send MessagePack and receive MessagePack.
e.POST("/").WithBytes([]byte(expectedMsgPackPayload)).
WithHeader("Content-Type", "application/msgpack").
WithHeader("Accept", "application/msgpack").
Expect().Status(httptest.StatusOK).
ContentType("application/msgpack").Body().Equal(expectedMsgPackPayload)
ContentType("application/msgpack").Body().IsEqual(expectedMsgPackPayload)
// Test send YAML and receive YAML.
e.POST("/").WithBytes([]byte(expectedYAMLPayload)).
WithHeader("Content-Type", "application/x-yaml").
WithHeader("Accept", "application/x-yaml").
Expect().Status(httptest.StatusOK).
ContentType("application/x-yaml").Body().Equal(expectedYAMLPayload)
ContentType("application/x-yaml").Body().IsEqual(expectedYAMLPayload)
}