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