-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronised head methods #13
Comments
Hey @julescmay! Thanks for the interesting question. You are absolutely right that nock should support basic HTTP protocol features. It could be done by adding nock.get('/path')
..reply(200, "body", headers: {})
..withHead(); Currently, I don't have much time to do it by myself (I'm Ukrainian, don't have much free time for now). |
I understand. My heartfelt sympathies. Stay safe.
IIUC http spec says that head should respond identically to get except for the lack of body. May I suggest: head response should be automatic unless:
Absolutely. Let me know your thoughts, and I'll get on it. |
Huge thanks for the kind words!
It's clear that it will be more intuitive to use.
Because there is no "priority" for the Interceptors, I have an idea to patch Registry.match method: If no interceptor is found and the requested method is HEAD try to find corresponding GET request and create a new HEAD Interceptor. |
That was exactly my thinking. I'm on it! |
I'm working on a module which checks the
head
s of uris before deciding which toget
. I've been able to create both theget
andhead
interceptors in Nock, as follows:But I'm constantly forgetting to add the heads!
It would be great if I could either set a flag to auto-generate the
head
s (so I didn't need to specify them) or write a single rule to translate everyhead
interceptor into the correspondingget
.Any ideas? Thanks.
The text was updated successfully, but these errors were encountered: