mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Set the Content-Type header when submitting a urlencoded form.
This commit is contained in:
parent
3239aeacdc
commit
19fbb9e568
1 changed files with 9 additions and 2 deletions
|
@ -23,6 +23,8 @@ use dom::htmlbuttonelement::{HTMLButtonElement};
|
||||||
use dom::htmltextareaelement::{HTMLTextAreaElement, HTMLTextAreaElementHelpers};
|
use dom::htmltextareaelement::{HTMLTextAreaElement, HTMLTextAreaElementHelpers};
|
||||||
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
|
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
|
||||||
use hyper::method::Method;
|
use hyper::method::Method;
|
||||||
|
use hyper::header::common::ContentType;
|
||||||
|
use hyper::mime;
|
||||||
use servo_msg::constellation_msg::LoadData;
|
use servo_msg::constellation_msg::LoadData;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
use script_task::{ScriptChan, ScriptMsg};
|
use script_task::{ScriptChan, ScriptMsg};
|
||||||
|
@ -186,12 +188,17 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
||||||
let _target = submitter.target();
|
let _target = submitter.target();
|
||||||
// TODO: Handle browsing contexts, partially loaded documents (step 16-17)
|
// TODO: Handle browsing contexts, partially loaded documents (step 16-17)
|
||||||
|
|
||||||
|
let mut load_data = LoadData::new(action_components);
|
||||||
|
|
||||||
let parsed_data = match enctype {
|
let parsed_data = match enctype {
|
||||||
FormEncType::UrlEncoded => serialize(form_data.iter().map(|d| (d.name.as_slice(), d.value.as_slice()))),
|
FormEncType::UrlEncoded => {
|
||||||
|
let mime: mime::Mime = "application/x-www-form-urlencoded".parse().unwrap();
|
||||||
|
load_data.headers.set(ContentType(mime));
|
||||||
|
serialize(form_data.iter().map(|d| (d.name.as_slice(), d.value.as_slice())))
|
||||||
|
}
|
||||||
_ => "".to_owned() // TODO: Add serializers for the other encoding types
|
_ => "".to_owned() // TODO: Add serializers for the other encoding types
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut load_data = LoadData::new(action_components);
|
|
||||||
// Step 18
|
// Step 18
|
||||||
match (scheme.as_slice(), method) {
|
match (scheme.as_slice(), method) {
|
||||||
(_, FormMethod::FormDialog) => return, // Unimplemented
|
(_, FormMethod::FormDialog) => return, // Unimplemented
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue