Skip to content

Commit

Permalink
Fixed typo in godoc
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Nov 8, 2015
1 parent 0097dfa commit 46a9318
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,20 @@ func (c *Context) JSON(code int, i interface{}) (err error) {
return
}

// JSON sends a JSON response with status code, but it applies prefix and indent to format the output.
// JSONIndent sends a JSON response with status code, but it applies prefix and indent to format the output.
func (c *Context) JSONIndent(code int, i interface{}, prefix string, indent string) (err error) {
b, err := json.MarshalIndent(i, prefix, indent)
if err != nil {
return err
}
c.json(code, b)
return
}

func (c *Context) json(code int, b []byte) {
c.response.Header().Set(ContentType, ApplicationJSONCharsetUTF8)
c.response.WriteHeader(code)
c.response.Write(b)
return
}

// JSONP sends a JSONP response with status code. It uses `callback` to construct
Expand Down Expand Up @@ -206,17 +210,21 @@ func (c *Context) XML(code int, i interface{}) (err error) {
return
}

// XML sends an XML response with status code, but it applies prefix and indent to format the output.
// XMLIndent sends an XML response with status code, but it applies prefix and indent to format the output.
func (c *Context) XMLIndent(code int, i interface{}, prefix string, indent string) (err error) {
b, err := xml.MarshalIndent(i, prefix, indent)
if err != nil {
return err
}
c.xml(code, b)
return
}

func (c *Context) xml(code int, b []byte) {
c.response.Header().Set(ContentType, ApplicationXMLCharsetUTF8)
c.response.WriteHeader(code)
c.response.Write([]byte(xml.Header))
c.response.Write(b)
return
}

// File sends a response with the content of the file. If `attachment` is set
Expand Down

0 comments on commit 46a9318

Please sign in to comment.