🎨 Use context methods instead const in CSRF middleware

This commit is contained in:
Maxim Lebedev 2021-11-15 02:03:39 +05:00
parent bc758dcb91
commit da22846868
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 2 additions and 2 deletions

View File

@ -116,8 +116,8 @@ func CSRFWithConfig(config CSRFConfig) Interceptor {
}
}
switch string(ctx.Method()) {
case http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodTrace:
switch {
case ctx.IsGet(), ctx.IsHead(), ctx.IsOptions(), ctx.IsTrace():
default:
// NOTE(toby3d): validate token only for requests which are not defined as 'safe' by RFC7231
clientToken, err := extractor(ctx)