minor (see previous commit)

This commit is contained in:
Gerasimos (Makis) Maropoulos 2021-01-07 05:36:56 +02:00
parent 240fdb6dc3
commit 541fa75caf
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7
4 changed files with 4 additions and 7 deletions

View File

@ -723,7 +723,7 @@ Response:
## Breaking Changes ## Breaking Changes
- Strict versions format on `versioning.NewGroup` is required. E.g. `"1"` is not valid anymore, you have to specify `"1.0.0"`. Example: `NewGroup(api, ">=1.0.0 <2.0.0")`. The [routing/versioning](_examples/routing/versioning) examples have been updated. - The `versioning.NewMatcher` has been removed entirely in favor of `NewGroup`. Strict versions format on `versioning.NewGroup` is required. E.g. `"1"` is not valid anymore, you have to specify `"1.0.0"`. Example: `NewGroup(api, ">=1.0.0 <2.0.0")`. The [routing/versioning](_examples/routing/versioning) examples have been updated.
- Now that `RegisterView` can be used to register different view engines per-Party, there is no need to support registering multiple engines under the same Party. The `app.RegisterView` now upserts the given Engine instead of append. You can now render templates **without file extension**, e.g. `index` instead of `index.ace`, both forms are valid now. - Now that `RegisterView` can be used to register different view engines per-Party, there is no need to support registering multiple engines under the same Party. The `app.RegisterView` now upserts the given Engine instead of append. You can now render templates **without file extension**, e.g. `index` instead of `index.ace`, both forms are valid now.
- The `Context.ContentType` does not accept filenames to resolve the mime type anymore (caused issues with vendor-specific(vnd) MIME types). - The `Context.ContentType` does not accept filenames to resolve the mime type anymore (caused issues with vendor-specific(vnd) MIME types).
- The `Configuration.RemoteAddrPrivateSubnets.IPRange.Start and End` are now type of `string` instead of `net.IP`. The `WithRemoteAddrPrivateSubnet` option remains as it is, already accepts `string`s. - The `Configuration.RemoteAddrPrivateSubnets.IPRange.Start and End` are now type of `string` instead of `net.IP`. The `WithRemoteAddrPrivateSubnet` option remains as it is, already accepts `string`s.

View File

@ -33,7 +33,7 @@ func main() {
You can customize it by setting a version based on the request context: You can customize it by setting a version based on the request context:
api.Use(func(ctx *context.Context) { api.Use(func(ctx *context.Context) {
if version := ctx.URLParam("version"); version != "" { if version := ctx.URLParam("version"); version != "" {
SetVersion(ctx, version) versioning.SetVersion(ctx, version)
} }
ctx.Next() ctx.Next()
@ -48,6 +48,8 @@ func main() {
// Create a new Group, which is a compatible Party, // Create a new Group, which is a compatible Party,
// based on version constraints. // based on version constraints.
v1 := versioning.NewGroup(api, ">=1.0.0 <2.0.0") v1 := versioning.NewGroup(api, ">=1.0.0 <2.0.0")
// To mark an API version as deprecated use the Deprecated method.
// v1.Deprecated(versioning.DefaultDeprecationOptions)
// Optionally, set custom view engine and path // Optionally, set custom view engine and path
// for templates based on the version. // for templates based on the version.

View File

@ -8,10 +8,6 @@ import (
"github.com/kataras/iris/v12/versioning" "github.com/kataras/iris/v12/versioning"
) )
func notFoundHandler(ctx iris.Context) {
ctx.NotFound()
}
const ( const (
v10Response = "v1.0 handler" v10Response = "v1.0 handler"
v2Response = "v2.x handler" v2Response = "v2.x handler"

View File

@ -244,7 +244,6 @@ func Handler(version string) context.Handler {
if err != nil { if err != nil {
return func(ctx *context.Context) { return func(ctx *context.Context) {
ctx.StopWithError(500, err) ctx.StopWithError(500, err)
return
} }
} }