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

Method updateAllowHeader

router.go:251–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249}
250
251func (m *routeMethods) updateAllowHeader() {
252 buf := new(bytes.Buffer)
253 buf.WriteString(http.MethodOptions)
254 hasAnyMethod := m.any != nil
255
256 if hasAnyMethod || m.connect != nil {
257 buf.WriteString(", ")
258 buf.WriteString(http.MethodConnect)
259 }
260 if hasAnyMethod || m.delete != nil {
261 buf.WriteString(", ")
262 buf.WriteString(http.MethodDelete)
263 }
264 if hasAnyMethod || m.get != nil {
265 buf.WriteString(", ")
266 buf.WriteString(http.MethodGet)
267 }
268 if hasAnyMethod || m.head != nil {
269 buf.WriteString(", ")
270 buf.WriteString(http.MethodHead)
271 }
272 if hasAnyMethod || m.patch != nil {
273 buf.WriteString(", ")
274 buf.WriteString(http.MethodPatch)
275 }
276 if hasAnyMethod || m.post != nil {
277 buf.WriteString(", ")
278 buf.WriteString(http.MethodPost)
279 }
280 if hasAnyMethod || m.propfind != nil {
281 buf.WriteString(", PROPFIND")
282 }
283 if hasAnyMethod || m.put != nil {
284 buf.WriteString(", ")
285 buf.WriteString(http.MethodPut)
286 }
287 if hasAnyMethod || m.trace != nil {
288 buf.WriteString(", ")
289 buf.WriteString(http.MethodTrace)
290 }
291 if hasAnyMethod || m.report != nil {
292 buf.WriteString(", REPORT")
293 }
294 for method := range m.anyOther { // for simplicity, we use map and therefore order is not deterministic here
295 buf.WriteString(", ")
296 buf.WriteString(method)
297 }
298 m.allowHeader = buf.String()
299}
300
301func (m *routeMethods) isHandler() bool {
302 return m.get != nil ||

Callers 1

setMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected