mirror of
https://github.com/kataras/iris.git
synced 2026-01-06 03:27:27 +00:00
Update to 4.0.0-alpha.3 - Response Engines, 'inject' the context.JSON/JSONP/Text/Data/Markdown/Render, Read HISTORY.md
## 4.0.0-alpha.2 -> 4.0.0-alpha.3
**New**
A **Response Engine** gives you the freedom to create/change the
render/response writer for
- `context.JSON`
- `context.JSONP`
- `context.XML`
- `context.Text`
- `context.Markdown`
- `context.Data`
- `context.Render("my_custom_type",mystructOrData{},
iris.RenderOptions{"gzip":false,"charset":"UTF-8"})`
- `context.MarkdownString`
- `iris.ResponseString(...)`
**Fix**
- https://github.com/kataras/iris/issues/294
**Small changes**
- `iris.Config.Charset`, before alpha.3 was `iris.Config.Rest.Charset` &
`iris.Config.Render.Template.Charset`, but you can override it at
runtime by passinth a map `iris.RenderOptions` on the `context.Render`
call .
- `iris.Config.IsDevelopment` , before alpha.1 was
`iris.Config.Render.Template.IsDevelopment`
**Websockets changes**
No need to import the `github.com/kataras/iris/websocket` to use the
`Connection` iteral, the websocket moved inside `kataras/iris` , now all
exported variables' names have the prefix of `Websocket`, so the old
`websocket.Connection` is now `iris.WebsocketConnection`.
Generally, no other changes on the 'frontend API', for response engines
examples and how you can register your own to add more features on
existing response engines or replace them, look
[here](https://github.com/iris-contrib/response).
**BAD SIDE**: E-Book is still pointing on the v3 release, but will be
updated soon.
This commit is contained in:
@@ -2,13 +2,13 @@ package config
|
||||
|
||||
import (
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/iris-contrib/rest"
|
||||
)
|
||||
|
||||
// Default values for base Iris conf
|
||||
const (
|
||||
DefaultDisablePathCorrection = false
|
||||
DefaultDisablePathEscape = false
|
||||
DefaultCharset = "UTF-8"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -89,12 +89,14 @@ type (
|
||||
// default is false
|
||||
IsDevelopment bool
|
||||
|
||||
// Charset character encoding for various rendering
|
||||
// used for templates and the rest of the responses
|
||||
// defaults to "UTF-8"
|
||||
Charset string
|
||||
|
||||
// Sessions contains the configs for sessions
|
||||
Sessions Sessions
|
||||
|
||||
// Rest contains the configs for rest render configuration
|
||||
Rest rest.Config
|
||||
|
||||
// Websocket contains the configs for Websocket's server integration
|
||||
Websocket *Websocket
|
||||
|
||||
@@ -111,9 +113,9 @@ func Default() Iris {
|
||||
DisableBanner: false,
|
||||
DisableTemplateEngines: false,
|
||||
IsDevelopment: false,
|
||||
Charset: DefaultCharset,
|
||||
ProfilePath: "",
|
||||
Sessions: DefaultSessions(),
|
||||
Rest: rest.DefaultConfig(),
|
||||
Websocket: DefaultWebsocket(),
|
||||
Tester: DefaultTester(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user