Webmock normalizes arrays in urls

Posted . Visible to the public.

Typhoeus Show archive.org snapshot has a different way of representing array params in a get request than RestClient Show archive.org snapshot .

Typhoeus: http://example.com/?foo[0]=1&foo[1]=2&foo[2]=3
RestClient: http://example.com/?foo[]=1&foo[]=2&foo[]=3

Webmock normalizes this url when matching to your stubs, so it is always http://example.com/?foo[]=1&foo[]=2&foo[]=3. This might lead to green tests, but in fact crashes in real world. Rack::Utils.build_nested_query might help to build a get request with Typhoeus manually if you need array urls without indexed keys.


Typhoeus is useful if you want to use parallel requests.

Last edit
Arne Hartherz
License
Source code in this card is licensed under the MIT License.
Posted by Emanuel to makandra dev (2017-06-07 07:32)