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 return err
} }

View File

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

View File

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