mirror of https://github.com/gin-gonic/gin.git
Fix minor type in context.go (#900)
* Fix minor type in context.go * More spelling fixes in context.go
This commit is contained in:
parent
6a3a8ae61b
commit
d4a53101c3
14
context.go
14
context.go
|
@ -91,7 +91,7 @@ func (c *Context) HandlerName() string {
|
||||||
|
|
||||||
// Next should be used only inside middleware.
|
// Next should be used only inside middleware.
|
||||||
// It executes the pending handlers in the chain inside the calling handler.
|
// It executes the pending handlers in the chain inside the calling handler.
|
||||||
// See example in github.
|
// See example in GitHub.
|
||||||
func (c *Context) Next() {
|
func (c *Context) Next() {
|
||||||
c.index++
|
c.index++
|
||||||
s := int8(len(c.handlers))
|
s := int8(len(c.handlers))
|
||||||
|
@ -114,7 +114,7 @@ func (c *Context) Abort() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AbortWithStatus calls `Abort()` and writes the headers with the specified status code.
|
// AbortWithStatus calls `Abort()` and writes the headers with the specified status code.
|
||||||
// For example, a failed attempt to authentificate a request could use: context.AbortWithStatus(401).
|
// For example, a failed attempt to authenticate a request could use: context.AbortWithStatus(401).
|
||||||
func (c *Context) AbortWithStatus(code int) {
|
func (c *Context) AbortWithStatus(code int) {
|
||||||
c.Status(code)
|
c.Status(code)
|
||||||
c.Writer.WriteHeaderNow()
|
c.Writer.WriteHeaderNow()
|
||||||
|
@ -163,7 +163,7 @@ func (c *Context) Error(err error) *Error {
|
||||||
/******** METADATA MANAGEMENT********/
|
/******** METADATA MANAGEMENT********/
|
||||||
/************************************/
|
/************************************/
|
||||||
|
|
||||||
// Set is used to store a new key/value pair exclusivelly for this context.
|
// Set is used to store a new key/value pair exclusively for this context.
|
||||||
// It also lazy initializes c.Keys if it was not used previously.
|
// It also lazy initializes c.Keys if it was not used previously.
|
||||||
func (c *Context) Set(key string, value interface{}) {
|
func (c *Context) Set(key string, value interface{}) {
|
||||||
if c.Keys == nil {
|
if c.Keys == nil {
|
||||||
|
@ -202,7 +202,7 @@ func (c *Context) Param(key string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query returns the keyed url query value if it exists,
|
// Query returns the keyed url query value if it exists,
|
||||||
// othewise it returns an empty string `("")`.
|
// otherwise it returns an empty string `("")`.
|
||||||
// It is shortcut for `c.Request.URL.Query().Get(key)`
|
// It is shortcut for `c.Request.URL.Query().Get(key)`
|
||||||
// GET /path?id=1234&name=Manu&value=
|
// GET /path?id=1234&name=Manu&value=
|
||||||
// c.Query("id") == "1234"
|
// c.Query("id") == "1234"
|
||||||
|
@ -215,7 +215,7 @@ func (c *Context) Query(key string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultQuery returns the keyed url query value if it exists,
|
// DefaultQuery returns the keyed url query value if it exists,
|
||||||
// othewise it returns the specified defaultValue string.
|
// otherwise it returns the specified defaultValue string.
|
||||||
// See: Query() and GetQuery() for further information.
|
// See: Query() and GetQuery() for further information.
|
||||||
// GET /?name=Manu&lastname=
|
// GET /?name=Manu&lastname=
|
||||||
// c.DefaultQuery("name", "unknown") == "Manu"
|
// c.DefaultQuery("name", "unknown") == "Manu"
|
||||||
|
@ -230,7 +230,7 @@ func (c *Context) DefaultQuery(key, defaultValue string) string {
|
||||||
|
|
||||||
// GetQuery is like Query(), it returns the keyed url query value
|
// GetQuery is like Query(), it returns the keyed url query value
|
||||||
// if it exists `(value, true)` (even when the value is an empty string),
|
// if it exists `(value, true)` (even when the value is an empty string),
|
||||||
// othewise it returns `("", false)`.
|
// otherwise it returns `("", false)`.
|
||||||
// It is shortcut for `c.Request.URL.Query().Get(key)`
|
// It is shortcut for `c.Request.URL.Query().Get(key)`
|
||||||
// GET /?name=Manu&lastname=
|
// GET /?name=Manu&lastname=
|
||||||
// ("Manu", true) == c.GetQuery("name")
|
// ("Manu", true) == c.GetQuery("name")
|
||||||
|
@ -507,7 +507,7 @@ func (c *Context) HTML(code int, name string, obj interface{}) {
|
||||||
|
|
||||||
// IndentedJSON serializes the given struct as pretty JSON (indented + endlines) into the response body.
|
// IndentedJSON serializes the given struct as pretty JSON (indented + endlines) into the response body.
|
||||||
// It also sets the Content-Type as "application/json".
|
// It also sets the Content-Type as "application/json".
|
||||||
// WARNING: we recommend to use this only for development propuses since printing pretty JSON is
|
// WARNING: we recommend to use this only for development purposes since printing pretty JSON is
|
||||||
// more CPU and bandwidth consuming. Use Context.JSON() instead.
|
// more CPU and bandwidth consuming. Use Context.JSON() instead.
|
||||||
func (c *Context) IndentedJSON(code int, obj interface{}) {
|
func (c *Context) IndentedJSON(code int, obj interface{}) {
|
||||||
c.Render(code, render.IndentedJSON{Data: obj})
|
c.Render(code, render.IndentedJSON{Data: obj})
|
||||||
|
|
Loading…
Reference in New Issue