change directory structure
This commit is contained in:
parent
850a2c6d68
commit
303dac9795
2
main.cr
2
main.cr
@ -2,5 +2,5 @@ require "./src/mechanize.cr"
|
|||||||
|
|
||||||
agent = Mechanize.new
|
agent = Mechanize.new
|
||||||
agent.request_headers = HTTP::Headers{"Foo" => "Bar"}
|
agent.request_headers = HTTP::Headers{"Foo" => "Bar"}
|
||||||
page = agent.get("https://example.com")
|
page = agent.get("https://example.com/")
|
||||||
puts page
|
puts page
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
require "./http/agent"
|
require "./mechanize/http/agent"
|
||||||
|
|
||||||
class Mechanize
|
class Mechanize
|
||||||
VERSION = "0.1.0"
|
VERSION = "0.1.0"
|
||||||
|
@ -12,6 +12,7 @@ module MechanizeCr
|
|||||||
|
|
||||||
def fetch(uri, method = :get, headers = HTTP::Headers.new)
|
def fetch(uri, method = :get, headers = HTTP::Headers.new)
|
||||||
add_request_headers(headers)
|
add_request_headers(headers)
|
||||||
|
|
||||||
response = http_request uri, method
|
response = http_request uri, method
|
||||||
puts response.not_nil!.body
|
puts response.not_nil!.body
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user