mirror of
https://github.com/labstack/echo.git
synced 2025-01-01 22:09:21 +02:00
fix some typos (#2603)
Signed-off-by: teslaedison <qingchengqiushuang@gmail.com>
This commit is contained in:
parent
fa70db801e
commit
34717b717d
@ -335,7 +335,7 @@ func (c *context) SetParamNames(names ...string) {
|
||||
|
||||
if len(c.pvalues) < l {
|
||||
// Keeping the old pvalues just for backward compatibility, but it sounds that doesn't make sense to keep them,
|
||||
// probably those values will be overriden in a Context#SetParamValues
|
||||
// probably those values will be overridden in a Context#SetParamValues
|
||||
newPvalues := make([]string, l)
|
||||
copy(newPvalues, c.pvalues)
|
||||
c.pvalues = newPvalues
|
||||
|
2
echo.go
2
echo.go
@ -419,7 +419,7 @@ func (e *Echo) Routers() map[string]*Router {
|
||||
//
|
||||
// NOTE: In case errors happens in middleware call-chain that is returning from handler (which did not return an error).
|
||||
// When handler has already sent response (ala c.JSON()) and there is error in middleware that is returning from
|
||||
// handler. Then the error that global error handler received will be ignored because we have already "commited" the
|
||||
// handler. Then the error that global error handler received will be ignored because we have already "committed" the
|
||||
// response and status code header has been sent to the client.
|
||||
func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) {
|
||||
|
||||
|
2
ip.go
2
ip.go
@ -64,7 +64,7 @@ XFF: "x" "x, a" "x, a, b"
|
||||
```
|
||||
|
||||
In this case, use **first _untrustable_ IP reading from right**. Never use first one reading from left, as it is
|
||||
configurable by client. Here "trustable" means "you are sure the IP address belongs to your infrastructre".
|
||||
configurable by client. Here "trustable" means "you are sure the IP address belongs to your infrastructure".
|
||||
In above example, if `b` and `c` are trustable, the IP address of the client is `a` for both cases, never be `x`.
|
||||
|
||||
In Echo, use `ExtractIPFromXFFHeader(...TrustOption)`.
|
||||
|
@ -194,7 +194,7 @@ func TestRequestLogger_LogValuesFuncError(t *testing.T) {
|
||||
e.ServeHTTP(rec, req)
|
||||
|
||||
// NOTE: when global error handler received error returned from middleware the status has already
|
||||
// been written to the client and response has been "commited" therefore global error handler does not do anything
|
||||
// been written to the client and response has been "committed" therefore global error handler does not do anything
|
||||
// and error that bubbled up in middleware chain will not be reflected in response code.
|
||||
assert.Equal(t, http.StatusTeapot, rec.Code)
|
||||
assert.Equal(t, http.StatusTeapot, expect.Status)
|
||||
|
Loading…
Reference in New Issue
Block a user