add post_form to cur_page
parent
031f112eb3
commit
69edb6e5ea
|
@ -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{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue