Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,11 @@ func (c *Context) ShouldBindJSON(obj interface{}) error {
return c.ShouldBindWith(obj, binding.JSON)
}

// ShouldBindMsgPack is a shortcut for c.ShouldBindWith(obj, binding.MsgPack).
func (c *Context) ShouldBindMsgPack(obj interface{}) error {
return c.ShouldBindWith(obj, binding.MsgPack)
}

// ShouldBindXML is a shortcut for c.ShouldBindWith(obj, binding.XML).
func (c *Context) ShouldBindXML(obj interface{}) error {
return c.ShouldBindWith(obj, binding.XML)
Expand Down Expand Up @@ -956,6 +961,12 @@ func (c *Context) JSON(code int, obj interface{}) {
c.Render(code, render.JSON{Data: obj})
}

// MsgPack serializes the given struct as MsgPack into the response body.
// It also sets the Content-Type as "application/msgpack".
func (c *Context) MsgPack(code int, obj interface{}) {
c.Render(code, render.MsgPack{Data: obj})
}

// AsciiJSON serializes the given struct as JSON into the response body with unicode to ASCII string.
// It also sets the Content-Type as "application/json".
func (c *Context) AsciiJSON(code int, obj interface{}) {
Expand Down