mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
_examples: replace DELETE string with iris.MethodDelete, for important changes see: https://github.com/kataras/iris/pull/909 and 6de64d517e
[formerly 35dd2ab80b69a5bea6f35f58e636bc11229d9921]
Former-commit-id: d0f5785aff289b8c140e4f253eb555135e79603d
This commit is contained in:
parent
6de64d517e
commit
a1232c9a9a
|
@ -5,19 +5,16 @@ package main
|
|||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/core/router"
|
||||
|
||||
"github.com/iris-contrib/middleware/cors"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
app := iris.New()
|
||||
|
||||
// `crs := cors.NewAllowAllPartyMiddleware()`, or:
|
||||
crs := cors.NewPartyMiddleware(cors.Options{
|
||||
AllowedOrigins: []string{"*"}, // allows everything, use that to change the hosts.
|
||||
AllowedMethods: router.AllMethods[:],
|
||||
AllowCredentials: true,
|
||||
})
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ func h(ctx iris.Context) {
|
|||
}
|
||||
|
||||
func fallbackHandler(ctx iris.Context) {
|
||||
if ctx.Method() == "DELETE" {
|
||||
if ctx.Method() == iris.MethodDelete {
|
||||
ctx.NextOrNotFound()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user