HTTP methods and their unique INTs
(s string)
| 900 | |
| 901 | // HTTP methods and their unique INTs |
| 902 | func (app *App) methodInt(s string) int { |
| 903 | // For better performance |
| 904 | if len(app.configured.RequestMethods) == 0 { |
| 905 | switch s { |
| 906 | case MethodGet: |
| 907 | return methodGet |
| 908 | case MethodHead: |
| 909 | return methodHead |
| 910 | case MethodPost: |
| 911 | return methodPost |
| 912 | case MethodPut: |
| 913 | return methodPut |
| 914 | case MethodDelete: |
| 915 | return methodDelete |
| 916 | case MethodConnect: |
| 917 | return methodConnect |
| 918 | case MethodOptions: |
| 919 | return methodOptions |
| 920 | case MethodTrace: |
| 921 | return methodTrace |
| 922 | case MethodPatch: |
| 923 | return methodPatch |
| 924 | case MethodQuery: |
| 925 | return methodQuery |
| 926 | default: |
| 927 | return -1 |
| 928 | } |
| 929 | } |
| 930 | // For method customization |
| 931 | return slices.Index(app.config.RequestMethods, s) |
| 932 | } |
| 933 | |
| 934 | func (app *App) method(methodInt int) string { |
| 935 | return app.config.RequestMethods[methodInt] |
no outgoing calls