mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-07 00:44:04 +00:00
Update vendor (#1560)
This commit is contained in:
20
vendor/github.com/labstack/echo/v4/context.go
generated
vendored
20
vendor/github.com/labstack/echo/v4/context.go
generated
vendored
@ -2,7 +2,6 @@ package echo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -276,9 +275,9 @@ func (c *context) RealIP() string {
|
||||
}
|
||||
// Fall back to legacy behavior
|
||||
if ip := c.request.Header.Get(HeaderXForwardedFor); ip != "" {
|
||||
i := strings.IndexAny(ip, ", ")
|
||||
i := strings.IndexAny(ip, ",")
|
||||
if i > 0 {
|
||||
return ip[:i]
|
||||
return strings.TrimSpace(ip[:i])
|
||||
}
|
||||
return ip
|
||||
}
|
||||
@ -457,17 +456,16 @@ func (c *context) String(code int, s string) (err error) {
|
||||
}
|
||||
|
||||
func (c *context) jsonPBlob(code int, callback string, i interface{}) (err error) {
|
||||
enc := json.NewEncoder(c.response)
|
||||
_, pretty := c.QueryParams()["pretty"]
|
||||
if c.echo.Debug || pretty {
|
||||
enc.SetIndent("", " ")
|
||||
indent := ""
|
||||
if _, pretty := c.QueryParams()["pretty"]; c.echo.Debug || pretty {
|
||||
indent = defaultIndent
|
||||
}
|
||||
c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8)
|
||||
c.response.WriteHeader(code)
|
||||
if _, err = c.response.Write([]byte(callback + "(")); err != nil {
|
||||
return
|
||||
}
|
||||
if err = enc.Encode(i); err != nil {
|
||||
if err = c.echo.JSONSerializer.Serialize(c, i, indent); err != nil {
|
||||
return
|
||||
}
|
||||
if _, err = c.response.Write([]byte(");")); err != nil {
|
||||
@ -477,13 +475,9 @@ func (c *context) jsonPBlob(code int, callback string, i interface{}) (err error
|
||||
}
|
||||
|
||||
func (c *context) json(code int, i interface{}, indent string) error {
|
||||
enc := json.NewEncoder(c.response)
|
||||
if indent != "" {
|
||||
enc.SetIndent("", indent)
|
||||
}
|
||||
c.writeContentType(MIMEApplicationJSONCharsetUTF8)
|
||||
c.response.Status = code
|
||||
return enc.Encode(i)
|
||||
return c.echo.JSONSerializer.Serialize(c, i, indent)
|
||||
}
|
||||
|
||||
func (c *context) JSON(code int, i interface{}) (err error) {
|
||||
|
Reference in New Issue
Block a user