Method
find
(method string, fallbackToAny bool)
Source from the content-addressed store, hash-verified
| 211 | } |
| 212 | |
| 213 | func (m *routeMethods) find(method string, fallbackToAny bool) *routeMethod { |
| 214 | var r *routeMethod |
| 215 | switch method { |
| 216 | case http.MethodConnect: |
| 217 | r = m.connect |
| 218 | case http.MethodDelete: |
| 219 | r = m.delete |
| 220 | case http.MethodGet: |
| 221 | r = m.get |
| 222 | case http.MethodHead: |
| 223 | r = m.head |
| 224 | case http.MethodOptions: |
| 225 | r = m.options |
| 226 | case http.MethodPatch: |
| 227 | r = m.patch |
| 228 | case http.MethodPost: |
| 229 | r = m.post |
| 230 | case PROPFIND: |
| 231 | r = m.propfind |
| 232 | case http.MethodPut: |
| 233 | r = m.put |
| 234 | case http.MethodTrace: |
| 235 | r = m.trace |
| 236 | case REPORT: |
| 237 | r = m.report |
| 238 | case RouteAny: |
| 239 | r = m.any |
| 240 | case RouteNotFound: |
| 241 | r = m.notFoundHandler |
| 242 | default: |
| 243 | r = m.anyOther[method] |
| 244 | } |
| 245 | if r != nil || !fallbackToAny { |
| 246 | return r |
| 247 | } |
| 248 | return m.any |
| 249 | } |
| 250 | |
| 251 | func (m *routeMethods) updateAllowHeader() { |
| 252 | buf := new(bytes.Buffer) |
Tested by
no test coverage detected