ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests
MIT License
3.46k stars 245 forks source link

relaxing headers check to allow partial matching #220

Closed skyboyer closed 4 years ago

skyboyer commented 5 years ago

Allowing mock match if request contains extra headers not specified in mock explicitly. https://github.com/ctimmerm/axios-mock-adapter/issues/219 https://github.com/ctimmerm/axios-mock-adapter/issues/214

mkalam-alami commented 5 years ago

This change would be very helpful. While it breaks retro-compatibility a bit it feels like a better default than the current behavior.

Alternately if we really want to keep retro-compatibility, we could let the headers argument be a function that takes the whole header object as input and accepts it or not.

ctimmerm commented 4 years ago

At this point I can't do breaking changes, however support for asymmetric matchers has been implemented in #181, which will allow you to achieve the same thing.