Open zacharyarnaise opened 1 year ago
I also stumbled upon an issue of the same kind I think.
If I have an URL that looks like: https://somewhere-over-the-rainbow.com
And another one like: https://tsomewhere-over-the-rainbow.com
If i define mocks on each URLs, they may be matched by the first URL (without the t
). There is probably something that checks with wildcard before the host or something ?
This was quite a confusing debug moment 😅
Edit: after looking at the documentation again it seems that the option DisableRegexpHost
might be what I was looking for ?
I believe that the documentation isn't clear enough about the fact that only hosts should be passed to
gock.New
. It's even more confusing becausegock
won't raise any errors if you do.The way things are actually, a gock like this:
Would match any requests with such URLs:
https://foobar.test/<this could be anything>/some-endpoint
.I think that the documentation should make this behaviour more apparent and since it's an expected behaviour,
gock.New
should raise an error if any part of URL that isn't a host is passed to it.