add uri escape test
parent
6f71f4c928
commit
1f97287eaf
|
@ -3,6 +3,7 @@ WebMock.stub(:get, "http://example.com/?foo=bar&foo1=bar2")
|
||||||
WebMock.stub(:post, "http://example.com/post").
|
WebMock.stub(:post, "http://example.com/post").
|
||||||
with(body: "email=foobar", headers: {"Content-Type" => "application/x-www-form-urlencoded"}).
|
with(body: "email=foobar", headers: {"Content-Type" => "application/x-www-form-urlencoded"}).
|
||||||
to_return(body: "success")
|
to_return(body: "success")
|
||||||
|
WebMock.stub(:get, "example.com/%E3%81%82%E3%81%82%E3%81%82")
|
||||||
|
|
||||||
describe "Mechanize HTTP test" do
|
describe "Mechanize HTTP test" do
|
||||||
it "simple GET" do
|
it "simple GET" do
|
||||||
|
@ -30,6 +31,12 @@ describe "Mechanize HTTP test" do
|
||||||
page.uri.to_s.should eq uri
|
page.uri.to_s.should eq uri
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "can escape non-ascii character" do
|
||||||
|
agent = Mechanize.new
|
||||||
|
page = agent.get("http://example.com/あああ")
|
||||||
|
page.uri.to_s.should eq "http://example.com/%E3%81%82%E3%81%82%E3%81%82"
|
||||||
|
end
|
||||||
|
|
||||||
it "set custom request headers" do
|
it "set custom request headers" do
|
||||||
agent = Mechanize.new
|
agent = Mechanize.new
|
||||||
uri = "http://example.com/"
|
uri = "http://example.com/"
|
||||||
|
|
Loading…
Reference in New Issue