examples: minor improvements

This commit is contained in:
Gerasimos (Makis) Maropoulos 2022-09-18 20:49:12 +03:00
parent 070a81d38f
commit a431a1c7d2
No known key found for this signature in database
GPG Key ID: 403EEB7885C79503
3 changed files with 4 additions and 7 deletions

View File

@ -151,6 +151,6 @@ func sendJSON(ctx iris.Context, resp interface{}) (err error) {
}
}
_, err = ctx.JSON(resp, iris.JSON{Indent: indent, UnescapeHTML: true})
err = ctx.JSON(resp, iris.JSON{Indent: indent, UnescapeHTML: true})
return err
}

View File

@ -14,11 +14,8 @@ func TestReadBodyAndNegotiate(t *testing.T) {
var (
expectedPayload = payload{Message: "a message"}
expectedMsgPackPayload = "\x81\xa7message\xa9a message"
expectedXMLPayload = `<payload>
<message>a message</message>
</payload>
`
expectedYAMLPayload = "Message: a message\n"
expectedXMLPayload = `<payload><message>a message</message></payload>`
expectedYAMLPayload = "Message: a message\n"
)
// Test send JSON and receive JSON.

View File

@ -58,7 +58,7 @@ func postIndexStream(ctx iris.Context) {
var users []User
job := func(decode iris.DecodeFunc) error {
var u User
if err := decode(ctx, &u); err != nil {
if err := decode(&u); err != nil {
return err
}
users = append(users, u)