mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
examples: minor improvements
This commit is contained in:
parent
070a81d38f
commit
a431a1c7d2
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user