fix(backend): added toUpper() method for network requests to avoid ignoring http methods in low case
This commit is contained in:
parent
4180780b13
commit
73a4339db2
1 changed files with 3 additions and 0 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
package url
|
package url
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
var METHODS = []string{"GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"}
|
var METHODS = []string{"GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"}
|
||||||
var TYPES = []string{"other", "script", "stylesheet", "fetch", "img", "media"}
|
var TYPES = []string{"other", "script", "stylesheet", "fetch", "img", "media"}
|
||||||
|
|
||||||
func EnsureMethod(method string) string {
|
func EnsureMethod(method string) string {
|
||||||
|
method = strings.ToUpper(method)
|
||||||
for _, m := range METHODS {
|
for _, m := range METHODS {
|
||||||
if m == method {
|
if m == method {
|
||||||
return method
|
return method
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue