* when url ends with slash first param route is the match (fix#1804)
* router should check if method is suitable for matching route and if not then continue search in tree (fix#1808)
Before this fix, Router#Find panics or enters in an infinite loop when
the context params values were set to a number less than the max number
of params supported by the Router.
This change allows middleware to replace the logger on the echo.Context
with a customized per-request logger with additional fields. The logger
is reset to default on every Reset() call.
* echo.context.cjson should encode the JSON before writing the status code #1334 :
`response.Write` automatically sets status to `200` if a response code wasn't committed yet. This is convenient, but it ignores the fact that `response.Status` is a public field that may be set separately/before `response.Write` has been called
A `response.Status` is by default `0`, or `200` if the response was reset, so `response.Write` should fallback to `200` only if a code wasn't set yet.
* echo.context.cjson should encode the JSON before writing the status code #1334 :
Writing the response code before encoding the payload is prone to error.
If JSON encoding fails, the response code is already committed, the server is able to only modify the response body to reflect the error and the user receives an awkward response where the status is successful but the body reports an error.
Instead - set the desired code on `c.response.Status`. If writing eventually takes place, the desired code is committed. If an error occurs, the server can still change the response.
* Test context path.
* Test context handler.
* Test handler error.
* Text context validate.
* Test context query string.
* Test context undefined param.
* Test context request.
* Test context scheme.
* Test context is websocket.
* Test context multipart form params with error.
* Text context bind.
* Text context logger.
* Text context xml response write error.
* Test context real ip.
* Automatically use JSONPretty/XMLPretty if '?pretty' in querystring
* Update unit test cases
* Simplify code according comments
* Update guide for pretty json/xml