Skip to content

Commit

Permalink
Merge pull request #987 from Fenny/master
Browse files Browse the repository at this point in the history
📚 update JSON description
  • Loading branch information
Fenny authored Nov 1, 2020
2 parents 5498f70 + 1ebdf49 commit 30228a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ func (c *Ctx) Is(extension string) bool {
}

// JSON converts any interface or string to JSON.
// Array and slice values encode as JSON arrays,
// except that []byte encodes as a base64-encoded string,
// and a nil slice encodes as the null JSON value.
// This method also sets the content header to application/json.
func (c *Ctx) JSON(data interface{}) error {
raw, err := json.Marshal(data)
Expand Down
14 changes: 8 additions & 6 deletions middleware/logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,19 @@ const (
TagURL = "url"
TagUA = "ua"
TagLatency = "latency"
TagStatus = "status"
TagBody = "body"
TagStatus = "status" // response status
TagBody = "body" // request body
TagBytesSent = "bytesSent"
TagBytesReceived = "bytesReceived"
TagRoute = "route"
TagError = "error"
TagHeader = "header:"
TagQuery = "query:"
TagForm = "form:"
TagCookie = "cookie:"
TagHeader = "header:" // request header
TagQuery = "query:" // request query
TagForm = "form:" // request form
TagCookie = "cookie:" // request cookie
TagLocals = "locals:"

// colors
TagBlack = "black"
TagRed = "red"
TagGreen = "green"
Expand Down

0 comments on commit 30228a1

Please sign in to comment.