Lack of clarity about the usage of `gock.New` and how it only matches hosts
zacharyarnaise opened this issue · comments
Zachary Arnaise commented
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 because gock
won't raise any errors if you do.
The way things are actually, a gock like this:
gock.New("https://foobar.test/api/v1").
Get("/some-endpoint").
Reply(200)
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.