diff --git a/src/mechanize/form.cr b/src/mechanize/form.cr index 439b021..5b7045f 100644 --- a/src/mechanize/form.cr +++ b/src/mechanize/form.cr @@ -9,18 +9,17 @@ class MechanizeCr::Form property action : String def initialize(node : Node | Myhtml::Node) - @enctype = node["enctype"]? ? node["enctype"] : "application/x-www-form-urlencoded" + @enctype = node.fetch("enctype", "application/x-www-form-urlencoded") @node = node - @fields = Array(MechanizeCr::FormContent::Field).new - @checkboxes = Array(MechanizeCr::FormContent::CheckBox).new - #@action = Mechanize::Util.html_unescape(node['action']) - @action = node["action"] - @method = (node["method"] || "GET").upcase + @fields = Array(MechanizeCr::FormContent::Field).new + @checkboxes = Array(MechanizeCr::FormContent::CheckBox).new + @action = node.fetch("action", "") + @method = node.fetch("method", "GET").upcase #@name = node['name'] #@clicked_buttons = [] #@page = page #@mech = mech -# + #@encoding = node['accept-charset'] || (page && page.encoding) || nil #@ignore_encoding_error = false parse