diff --git a/spec/http_spec.cr b/spec/http_spec.cr index 88e98b2..2286a86 100644 --- a/spec/http_spec.cr +++ b/spec/http_spec.cr @@ -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/"