Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp |
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
index d656155b3fdb1186e4d61032eada2a8d6afb07c3..aa7c1c38a94b01f1ac32041e4f84039018548a7c 100644 |
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
@@ -791,13 +791,12 @@ void XMLHttpRequest::send(Document* document, ExceptionState& exceptionState) |
RefPtr<FormData> httpBody; |
if (areMethodAndURLValidForSend()) { |
- if (getRequestHeader("Content-Type").isEmpty()) { |
- // FIXME: this should include the charset used for encoding. |
- setRequestHeaderInternal("Content-Type", "application/xml"); |
- } |
+ // FIXME: Per https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send the |
+ // Content-Type header and whether to serialize as HTML or XML should |
+ // depend on |document->isHTMLDocument()|. |
+ if (getRequestHeader("Content-Type").isEmpty()) |
+ setRequestHeaderInternal("Content-Type", "application/xml;charset=UTF-8"); |
- // FIXME: According to XMLHttpRequest Level 2, this should use the Document.innerHTML algorithm |
- // from the HTML5 specification to serialize the document. |
String body = createMarkup(document); |
httpBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesForUnencodables)); |