add post_form to cur_page

master
Kanezoh 2021-08-09 08:34:46 +09:00
parent 031f112eb3
commit 69edb6e5ea
3 changed files with 6 additions and 3 deletions

View File

@ -38,9 +38,9 @@ class Mechanize
post_form(uri, form, headers)
end
# send POST request from form.
def post_form(uri, form, headers)
#cur_page = form.page || current_page ||
# Page.new
cur_page = form.page || (current_page unless history.empty?)
request_data = form.request_data
content_headers = ::HTTP::Headers{

View File

@ -20,6 +20,7 @@ class MechanizeCr::Form
getter enctype : String
getter method : String
getter name : String
getter page : Page?
property action : String
def initialize(node : Node | Myhtml::Node, page : Page? = nil)

View File

@ -18,7 +18,9 @@ module MechanizeCr
@user_agent = ""
end
def fetch(uri, method = :get, headers = HTTP::Headers.new, params = Hash(String,String).new)
def fetch(uri, method = :get, headers = HTTP::Headers.new, params = Hash(String,String).new,
)#referer = current_page)
#referer_uri = referer.uri
uri = resolve(uri)
set_request_headers(uri, headers)
set_user_agent