mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 03:01:03 +01:00
add a HISTORY note about the Context#ReadForm return error
Former-commit-id: ae423978262575d21d098f1ca2986de05d0cda49
This commit is contained in:
parent
df85be52a4
commit
977b67dd47
|
@ -25,6 +25,7 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene
|
||||||
- `:int` parameter type **can accept negative numbers now**.
|
- `:int` parameter type **can accept negative numbers now**.
|
||||||
- `app.Macros().String/Int/Uint64/Path...RegisterFunc` should be replaced to: `app.Macros().Get("string" or "int" or "uint64" or "path" when "path" is the ":path" parameter type).RegisterFunc`, because you can now add custom macros and parameter types as well, see [here](_examples/routing/macros).
|
- `app.Macros().String/Int/Uint64/Path...RegisterFunc` should be replaced to: `app.Macros().Get("string" or "int" or "uint64" or "path" when "path" is the ":path" parameter type).RegisterFunc`, because you can now add custom macros and parameter types as well, see [here](_examples/routing/macros).
|
||||||
- `RegisterFunc("min", func(paramValue string) bool {...})` should be replaced to `RegisterFunc("min", func(paramValue <T>) bool {...})`, the `paramValue` argument is now stored in the exact type the macro's type evaluator inits it, i.e `uint64` or `int` and so on, therefore you don't have to convert the parameter value each time (this should make your handlers with macro functions activated even faster now)
|
- `RegisterFunc("min", func(paramValue string) bool {...})` should be replaced to `RegisterFunc("min", func(paramValue <T>) bool {...})`, the `paramValue` argument is now stored in the exact type the macro's type evaluator inits it, i.e `uint64` or `int` and so on, therefore you don't have to convert the parameter value each time (this should make your handlers with macro functions activated even faster now)
|
||||||
|
- The `Context#ReadForm` will no longer return an error if it has no value to read from the request, we let those checks to the caller and validators as requested at: https://github.com/kataras/iris/issues/1095 by [@haritsfahreza](https://github.com/haritsfahreza)
|
||||||
|
|
||||||
## Routing
|
## Routing
|
||||||
|
|
||||||
|
|
|
@ -2864,12 +2864,10 @@ func (ctx *context) JSON(v interface{}, opts ...JSON) (n int, err error) {
|
||||||
options = opts[0]
|
options = opts[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
optimize := ctx.shouldOptimize()
|
|
||||||
|
|
||||||
ctx.ContentType(ContentJSONHeaderValue)
|
ctx.ContentType(ContentJSONHeaderValue)
|
||||||
|
|
||||||
if options.StreamingJSON {
|
if options.StreamingJSON {
|
||||||
if optimize {
|
if ctx.shouldOptimize() {
|
||||||
var jsoniterConfig = jsoniter.Config{
|
var jsoniterConfig = jsoniter.Config{
|
||||||
EscapeHTML: !options.UnescapeHTML,
|
EscapeHTML: !options.UnescapeHTML,
|
||||||
IndentionStep: 4,
|
IndentionStep: 4,
|
||||||
|
@ -2890,7 +2888,7 @@ func (ctx *context) JSON(v interface{}, opts ...JSON) (n int, err error) {
|
||||||
return ctx.writer.Written(), err
|
return ctx.writer.Written(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err = WriteJSON(ctx.writer, v, options, optimize)
|
n, err = WriteJSON(ctx.writer, v, options, ctx.shouldOptimize())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.StatusCode(http.StatusInternalServerError)
|
ctx.StatusCode(http.StatusInternalServerError)
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user