(method, { hasBody = false } = {})
| 819 | } |
| 820 | |
| 821 | function addHttpMethod (method, { hasBody = false } = {}) { |
| 822 | if (typeof method !== 'string' || http.METHODS.indexOf(method) === -1) { |
| 823 | throw new FST_ERR_ROUTE_METHOD_INVALID() |
| 824 | } |
| 825 | |
| 826 | if (hasBody === true) { |
| 827 | this[kSupportedHTTPMethods].bodywith.add(method) |
| 828 | this[kSupportedHTTPMethods].bodyless.delete(method) |
| 829 | } else { |
| 830 | this[kSupportedHTTPMethods].bodywith.delete(method) |
| 831 | this[kSupportedHTTPMethods].bodyless.add(method) |
| 832 | } |
| 833 | |
| 834 | const _method = method.toLowerCase() |
| 835 | if (!this.hasDecorator(_method)) { |
| 836 | this.decorate(_method, function (url, options, handler) { |
| 837 | return router.prepareRoute.call(this, { method, url, options, handler }) |
| 838 | }) |
| 839 | } |
| 840 | |
| 841 | return this |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | function processOptions (options, defaultRoute, onBadUrl, onMaxParamLength) { |
nothing calls this directly
no test coverage detected