MCPcopy Index your code
hub / github.com/labstack/echo / set

Method set

router.go:171–211  ·  view source on GitHub ↗
(method string, r *routeMethod)

Source from the content-addressed store, hash-verified

169}
170
171func (m *routeMethods) set(method string, r *routeMethod) {
172 switch method {
173 case http.MethodConnect:
174 m.connect = r
175 case http.MethodDelete:
176 m.delete = r
177 case http.MethodGet:
178 m.get = r
179 case http.MethodHead:
180 m.head = r
181 case http.MethodOptions:
182 m.options = r
183 case http.MethodPatch:
184 m.patch = r
185 case http.MethodPost:
186 m.post = r
187 case PROPFIND:
188 m.propfind = r
189 case http.MethodPut:
190 m.put = r
191 case http.MethodTrace:
192 m.trace = r
193 case REPORT:
194 m.report = r
195 case RouteAny:
196 m.any = r
197 case RouteNotFound:
198 m.notFoundHandler = r
199 return // RouteNotFound/404 is not considered as a handler so no further logic needs to be executed
200 default:
201 if m.anyOther == nil {
202 m.anyOther = make(map[string]*routeMethod)
203 }
204 if r.handler == nil {
205 delete(m.anyOther, method)
206 } else {
207 m.anyOther[method] = r
208 }
209 }
210 m.updateAllowHeader()
211}
212
213func (m *routeMethods) find(method string, fallbackToAny bool) *routeMethod {
214 var r *routeMethod

Callers 1

setHandlerMethod · 0.80

Calls 1

updateAllowHeaderMethod · 0.95

Tested by

no test coverage detected