30 Commits

Author SHA1 Message Date
HoneyryderChuck
c70209db4b added xml transcoder
capabilities to encod/decode xml, expects nokogiri.
2022-08-13 15:42:46 +01:00
HoneyryderChuck
82a3657153 disabling pattern matching tests for truffleruby 2022-03-21 23:43:38 +00:00
HoneyryderChuck
f768cf7a0e Improving API compatibility and error checking in responses
* `Response#error`, which, coupled with `ErrorResponse#error`, allows
  for `if response.error` kind of conditional;
* `Response#raise_for_status` now returns the response when no error is
  raise (for method chaining);

Closes #153
2021-09-20 13:02:20 +01:00
ojab
6f3b11eb16
Fixup decoders content type checks 2021-09-10 15:53:38 +00:00
HoneyryderChuck
c95e926886 auto-corrected the easy ones first 2021-09-03 12:24:18 +01:00
HoneyryderChuck
f2d3c1f09b added Response#form (supports only x-www-urlencoded for now) 2021-08-09 15:54:25 +01:00
HoneyryderChuck
e5a120111c added tests for json and form (also multipart) decoders 2021-08-09 15:54:24 +01:00
HoneyryderChuck
e43d5eddcd making body comparison less wasteful, while keeping existing poinnters after call to to_s 2021-07-24 04:00:19 +01:00
HoneyryderChuck
0f1d8cb271 make Response#to_s non-destructive, and keep the body around
for most cases, this didn't make sense, i.e. response bodies were so
    small, and the user is fine with keeping it all in mem, whereas
    clearing the string is more confusing. And it breaks pattern
    matching when matching body multiple times.
2021-07-24 04:00:19 +01:00
HoneyryderChuck
34c6562469 enabling pattern matching only for 3.0.0 2021-06-17 18:09:00 +01:00
HoneyryderChuck
c7704b6e15 disable pattern matching tests for truffleruby 2021-06-12 13:57:54 +01:00
HoneyryderChuck
f7ecc145e6 added pattern-matching support for responses 2021-06-12 02:44:16 +01:00
HoneyryderChuck
12d4885136 response body now holds the full options from the request 2021-03-05 19:04:09 +00:00
HoneyryderChuck
b6c94f1702 added test for unsupported charset in response 2021-02-18 10:43:48 +00:00
HoneyryderChuck
7e26c86dc1 really closing a response (won't buffer stuff anymore after being closed) 2020-11-22 15:55:44 +00:00
HoneyryderChuck
41ca6fadbb added test for copy_to; also, fixed it (rewind before copy) 2020-03-15 19:59:39 +00:00
HoneyryderChuck
aebadc8bc9 testing Response#read 2020-03-10 18:58:31 +00:00
HoneyryderChuck
6005165271 testing status reach of HTTPError 2019-12-31 01:56:21 +00:00
HoneyryderChuck
a421fb121b minimal changes to accomodate new kwargs syntax 2019-12-30 02:24:04 +00:00
HoneyryderChuck
e36c6347bf rubocop indications 2018-03-23 14:48:10 +00:00
HoneyryderChuck
67eb755a3b added Response#raise_for_status, which raises an exception if the http code is an error code; it also duck-types the error response, which will raise its exception 2018-03-23 10:53:16 +00:00
HoneyryderChuck
2b1ab8b6b6 rubocop auto-corrections according to some basic rules for now 2018-01-28 22:33:41 +00:00
HoneyryderChuck
57aa3b5159 testing the client yield feature and the response body buffer transitions 2018-01-28 21:59:08 +00:00
HoneyryderChuck
284bb06663 added versioning to response (important to test h2c, but also to ensure which 1.x is responding) 2018-01-06 19:23:39 +00:00
HoneyryderChuck
957fc46bcf response: do not alias #write to #<<, makes it hard to extend; #each now yields predictable-size chunks, instead of deferring to buffer#each, which can do whatever 2017-12-22 13:14:33 +02:00
HoneyryderChuck
15a5ffffdd allow to pass a custom body class, which only needs to implement the constructor signature and #<< 2017-12-11 13:10:58 +00:00
HoneyryderChuck
40a73f5a7b made body threshold size (the max buffered size after which the response body is buffered to disk) a top-level option 2017-12-11 12:43:05 +00:00
HoneyryderChuck
d8eb3bbe5f went back from returning partial responses, and only expose fully buffered responses to the user; the main issue being, the main API favours closing the connection after requests, and this makes the whole handling of partial responses confusing and error prone; this way, one can buffer the body, even to the filesystem, and maybe make this tunable in the future 2017-12-08 19:01:44 +00:00
HoneyryderChuck
ee59c71274 allow to return early responses just with headers; added a bufferable body, which means, when body is requests, it fetches it (if not available yet); for this, the selector must be exposed to all sub-levels; the response body by default buffers first/returns later for #to_s, and buffers and yields chunks on #each 2017-12-06 17:20:03 +00:00
HoneyryderChuck
46a1223187 addest tests for headers/request/response 2017-11-28 14:00:16 +00:00