add uri escape test

master
Kanezoh 2021-08-09 17:49:06 +09:00
parent 6f71f4c928
commit 1f97287eaf
1 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,7 @@ WebMock.stub(:get, "http://example.com/?foo=bar&foo1=bar2")
WebMock.stub(:post, "http://example.com/post").
with(body: "email=foobar", headers: {"Content-Type" => "application/x-www-form-urlencoded"}).
to_return(body: "success")
WebMock.stub(:get, "example.com/%E3%81%82%E3%81%82%E3%81%82")
describe "Mechanize HTTP test" do
it "simple GET" do
@ -30,6 +31,12 @@ describe "Mechanize HTTP test" do
page.uri.to_s.should eq uri
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
agent = Mechanize.new
uri = "http://example.com/"