From 303dac97956b004f65364c0216f4de183706a526 Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Sun, 2 May 2021 13:23:23 +0900 Subject: [PATCH] change directory structure --- main.cr | 2 +- src/mechanize.cr | 2 +- src/{ => mechanize}/http/agent.cr | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) rename src/{ => mechanize}/http/agent.cr (98%) diff --git a/main.cr b/main.cr index d47039f..842bf3c 100644 --- a/main.cr +++ b/main.cr @@ -2,5 +2,5 @@ require "./src/mechanize.cr" agent = Mechanize.new agent.request_headers = HTTP::Headers{"Foo" => "Bar"} -page = agent.get("https://example.com") +page = agent.get("https://example.com/") puts page diff --git a/src/mechanize.cr b/src/mechanize.cr index f12ed82..94b04c7 100644 --- a/src/mechanize.cr +++ b/src/mechanize.cr @@ -1,4 +1,4 @@ -require "./http/agent" +require "./mechanize/http/agent" class Mechanize VERSION = "0.1.0" diff --git a/src/http/agent.cr b/src/mechanize/http/agent.cr similarity index 98% rename from src/http/agent.cr rename to src/mechanize/http/agent.cr index 68c921d..aa86ad5 100644 --- a/src/http/agent.cr +++ b/src/mechanize/http/agent.cr @@ -12,6 +12,7 @@ module MechanizeCr def fetch(uri, method = :get, headers = HTTP::Headers.new) add_request_headers(headers) + response = http_request uri, method puts response.not_nil!.body end