mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-07 00:05:02 -04:00
add test for case when body only responds to #length
This commit is contained in:
parent
896253bcbc
commit
d24cf98785
@ -77,6 +77,28 @@ module Requests
|
||||
verify_uploaded(body, "data", "data")
|
||||
end
|
||||
|
||||
define_method :"test_#{meth}_body_length_params" do
|
||||
uri = build_uri("/#{meth}")
|
||||
body = Class.new do
|
||||
def initialize(body)
|
||||
@body = body
|
||||
end
|
||||
|
||||
def length
|
||||
@body.size
|
||||
end
|
||||
|
||||
def each(&b)
|
||||
@body.each(&b)
|
||||
end
|
||||
end.new(%w[d a t a])
|
||||
response = HTTPX.send(meth, uri, body: body)
|
||||
verify_status(response, 200)
|
||||
body = json_body(response)
|
||||
verify_header(body["headers"], "Content-Type", "application/octet-stream")
|
||||
verify_uploaded(body, "data", "data")
|
||||
end
|
||||
|
||||
define_method :"test_#{meth}_body_each_params" do
|
||||
uri = build_uri("/#{meth}")
|
||||
body = Class.new do
|
||||
|
Loading…
x
Reference in New Issue
Block a user