mirror of
https://github.com/lostisland/faraday.git
synced 2025-11-22 00:08:56 -05:00
ensure no regex warnings about UTF-8 strings
This is a cherry-pick of 3dddbfcd776930910d065744517394565339ec2f References #95
This commit is contained in:
parent
a81b7052cc
commit
c78cb61ef1
@ -1,4 +1,5 @@
|
|||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
require 'stringio'
|
||||||
|
|
||||||
if ENV['LEFTRIGHT']
|
if ENV['LEFTRIGHT']
|
||||||
begin
|
begin
|
||||||
@ -29,6 +30,16 @@ module Faraday
|
|||||||
def test_default
|
def test_default
|
||||||
assert true
|
assert true
|
||||||
end unless defined? ::MiniTest
|
end unless defined? ::MiniTest
|
||||||
|
|
||||||
|
def capture_warnings
|
||||||
|
old, $stderr = $stderr, StringIO.new
|
||||||
|
begin
|
||||||
|
yield
|
||||||
|
$stderr.string
|
||||||
|
ensure
|
||||||
|
$stderr = old
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# encoding: utf-8
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
||||||
|
|
||||||
Faraday::CompositeReadIO.send :attr_reader, :ios
|
Faraday::CompositeReadIO.send :attr_reader, :ios
|
||||||
@ -47,6 +48,14 @@ class RequestMiddlewareTest < Faraday::TestCase
|
|||||||
assert_equal expected, Faraday::Utils.parse_nested_query(response.body)
|
assert_equal expected, Faraday::Utils.parse_nested_query(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_url_encoded_unicode
|
||||||
|
err = capture_warnings {
|
||||||
|
response = @conn.post('/echo', {:str => "eé cç aã aâ"})
|
||||||
|
assert_equal "str=e%C3%A9+c%C3%A7+a%C3%A3+a%C3%A2", response.body
|
||||||
|
}
|
||||||
|
assert err.empty?
|
||||||
|
end
|
||||||
|
|
||||||
def test_multipart
|
def test_multipart
|
||||||
# assume params are out of order
|
# assume params are out of order
|
||||||
regexes = [
|
regexes = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user