Context
#1614 (comment)
In order to gain full code coverage, a test was added to show current expected behavior around what happens if a search param is set twice.
nock('http://example.test')
.get('/')
.query({ foo: 'bar' })
.query({ foo: 'baz' })
.reply()
Current behavior prefers the first value and silently ignores any subsequent values. This example will match http://example.test?foo=bar.
This is confusing and probably hides unintended bugs by users.
Alternatives
Interceptor.query should throw an error if a duplicate key is provided with a clear error message.
The "key" being checked should be the value returned by formatQueryValue instead of the input key.
The new test from #1614 should be updated test the new expected behavior.
Context
#1614 (comment)
In order to gain full code coverage, a test was added to show current expected behavior around what happens if a search param is set twice.
Current behavior prefers the first value and silently ignores any subsequent values. This example will match
http://example.test?foo=bar.This is confusing and probably hides unintended bugs by users.
Alternatives
Interceptor.queryshould throw an error if a duplicate key is provided with a clear error message.The "key" being checked should be the value returned by
formatQueryValueinstead of the input key.The new test from #1614 should be updated test the new expected behavior.