mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-12-15 00:01:02 -05:00
rubocop changes
This commit is contained in:
parent
caa5bb43c7
commit
3d4fe177e3
@ -115,7 +115,7 @@ module HTTPX
|
||||
elsif value.respond_to?(:each)
|
||||
digest = OpenSSL::Digest.new(@algorithm)
|
||||
|
||||
mb_buffer = value.each.each_with_object("".b) do |chunk, buffer|
|
||||
mb_buffer = value.each.with_object("".b) do |chunk, buffer|
|
||||
buffer << chunk
|
||||
break if buffer.bytesize >= 1024 * 1024
|
||||
end
|
||||
|
||||
@ -60,7 +60,7 @@ module ResponseHelpers
|
||||
case expectation
|
||||
when Regexp
|
||||
assert response.error.message =~ expectation,
|
||||
"expected to match \/#{expectation}\/ in \"#{response.error.message}\""
|
||||
"expected to match /#{expectation}/ in \"#{response.error.message}\""
|
||||
when String
|
||||
assert response.error.message.include?(expectation),
|
||||
"expected \"#{response.error.message}\" to include \"#{expectation}\""
|
||||
|
||||
@ -108,7 +108,7 @@ module Requests
|
||||
|
||||
# Test special cases
|
||||
special_jar = HTTPX::Plugins::Cookies::Jar.new
|
||||
special_jar.parse(%(a="b"; Path=/, c=d; Path=/, e="f\\\"; \\\"g"))
|
||||
special_jar.parse(%(a="b"; Path=/, c=d; Path=/, e="f\\"; \\"g"))
|
||||
cookies = special_jar[jar_cookies_uri]
|
||||
assert(cookies.one? { |cookie| cookie.name == "a" && cookie.value == "b" })
|
||||
assert(cookies.one? { |cookie| cookie.name == "c" && cookie.value == "d" })
|
||||
@ -187,7 +187,7 @@ module Requests
|
||||
|
||||
# quoting funny characters
|
||||
sch_cookie = HTTPX::Plugins::Cookies::Cookie.new("Bar", "value\"4")
|
||||
assert sch_cookie.cookie_value == %(Bar="value\\\"4")
|
||||
assert sch_cookie.cookie_value == %(Bar="value\\"4")
|
||||
|
||||
# sorting
|
||||
c1 = HTTPX::Plugins::Cookies::Cookie.new("a", "b")
|
||||
|
||||
@ -30,7 +30,7 @@ module Requests
|
||||
session = HTTPX.plugin(:stream)
|
||||
|
||||
response = session.get(build_uri("/stream/3"), stream: true)
|
||||
lines = response.each_line.each_with_index.map do |line, idx|
|
||||
lines = response.each_line.with_index.map do |line, idx|
|
||||
assert !line.end_with?("\n")
|
||||
data = JSON.parse(line)
|
||||
assert data["id"] == idx
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user