MCPcopy Create free account
hub / github.com/fastify/fastify / normalizeAndValidateMethod

Function normalizeAndValidateMethod

lib/route.js:602–613  ·  view source on GitHub ↗
(method)

Source from the content-addressed store, hash-verified

600}
601
602function normalizeAndValidateMethod (method) {
603 if (typeof method !== 'string') {
604 throw new FST_ERR_ROUTE_METHOD_INVALID()
605 }
606 method = method.toUpperCase()
607 if (!this[kSupportedHTTPMethods].bodyless.has(method) &&
608 !this[kSupportedHTTPMethods].bodywith.has(method)) {
609 throw new FST_ERR_ROUTE_METHOD_NOT_SUPPORTED(method)
610 }
611
612 return method
613}
614
615function validateSchemaBodyOption (method, path, schema) {
616 if (this[kSupportedHTTPMethods].bodyless.has(method) && schema?.body) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected