1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00
Commit graph

11 commits

Author SHA1 Message Date
Andy Brody
0d8f777fec Fix default Net::HTTP encoding in Windows tests.
It turns out that Net::HTTP seems to always use UTF-8 as the default
encoding, even when Encoding.default_external is Encoding::IBM437 (as it
is on Windows/mingw).
2016-06-19 14:11:42 -07:00
Andy Brody
bad70fb1d8 Add more tests for Utils.encode_query_string.
These tests, which follow the yard-doc examples, exercise the
new ParamsArray behavior.
2016-01-26 23:02:07 -05:00
Andy Brody
87c92af1be Switch to using flatten_params everywhere.
Remove the old standalone implementation of Utils.encode_query_string in
favor of the unified version based on Utils.flatten_params.

This means that params in GET, POST x-www-form-urlencoded, and
POST multipart/form-data will all be handled in the same way (except for
escaping, since multipart/form-data is not escaped).
2015-11-23 14:08:58 -08:00
Andy Brody
0b8e232f12 Reimplement flatten_params in a more unified way.
Begin the transition to unified HTTP parameter flattening by
reimplementing Payload::Base#flatten_params as Utils.flatten_params.

This new method uses a single recursive function rather than two
mutually recursive functions. It also establishes more unified handling
of URI escaping and nil or empty values.

Add a new method Utils.encode_query_string2 that is implemented in terms
of flatten_params. This will replace Utils.encode_query_string in the
next commit, but keep them both around in this commit for ease of
directly comparing their output to verify their equivalence.
2015-11-23 14:01:23 -08:00
Andy Brody
7681a2c660 Introduce ParamsArray to support repeated params.
Because of RestClient's use of Hashes to represent structured HTTP
parameters, there was previously no way to pass a structured ruby object
that contained the same key multiple times.

ParamsArray behaves similarly to Array, but enforces a little more
validation. It is intended to be used in place of a Hash in methods to
process HTTP parameters where duplicate keys are desired.
2015-11-23 13:56:21 -08:00
Andy Brody
a75a3b5017 Tweak documentation in Utils. 2015-11-23 13:51:34 -08:00
Andy Brody
42ce89e104 Use escaping from URI, not CGI.
Use URI.encode_www_form_component instead of CGI.escape. They are almost
identical except that CGI.escape additionally escapes `*`.
2015-11-12 00:21:24 -08:00
Andy Brody
2dd4b3739d Enable new GET param generation, add tests.
Switch the generation of HTTP GET params over to the new, more
featureful method in Utils, which handles Rack/Rails style nested
parameters. Also add a variety of tests for this functionality.
2015-11-12 00:11:33 -08:00
Andy Brody
43e6132042 Add new featureful implementation of HTTP params. 2015-11-08 04:04:23 -08:00
Andy Brody
6d7818f517 Per RFC 7231, don't default to ISO-8859-1. 2015-03-13 16:33:46 -07:00
Andy Brody
29b56a33f3 Add functions for parsing content-type headers. 2015-01-28 02:45:02 -08:00