You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand the issue, but your proposed fix is not suitable, as we don't want to allow head to be allowed in the route method field. I have looked further into it, and revised the method typings to be correct for all method fields in #4493. The exact typings for each method turns out to be unique for all of them.
Runtime
node.js
Runtime version
18
Module version
21
Last module version without issue
No response
Used with
No response
Any other relevant information
No response
What are you trying to achieve or the steps to reproduce?
We have a controller that must only respond to the
head
methodHapi works with it by creating a
get
route and then checkingrequest.method
formethod === "head"
But types from
@hapi/hapi
do not supporthead
!In
lib/types/utils.d.ts
line 14:export type HTTP_METHODS_PARTIAL_LOWERCASE = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options';
All we need to do to fix this is add
| 'head'
to the list!What was the result you got?
if(method === "head") {
typescript: This comparison appears to be unintentional because the types 'HTTP_METHODS_PARTIAL_LOWERCASE' and '"head"' have no overlap. [2367]
What result did you expect?
Expected it to work!
I can raise a PR if you want?
The text was updated successfully, but these errors were encountered: