From 1f97287eaf7f983611483b704e47007f2ddbc3e4 Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Mon, 9 Aug 2021 17:49:06 +0900 Subject: [PATCH] add uri escape test --- spec/http_spec.cr | 7 +++++++ 1 file changed, 7 insertions(+) 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/"