mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
LibWeb: Implement XMLHttpRequest.getAllResponseHeaders()
This commit is contained in:
parent
95559c4277
commit
7ef4d75716
3 changed files with 21 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibWeb/Bindings/EventWrapper.h>
|
||||
#include <LibWeb/Bindings/XMLHttpRequestWrapper.h>
|
||||
|
@ -271,4 +272,22 @@ void XMLHttpRequest::set_onreadystatechange(HTML::EventHandler value)
|
|||
set_event_handler_attribute(Web::XHR::EventNames::readystatechange, move(value));
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method
|
||||
String XMLHttpRequest::get_all_response_headers() const
|
||||
{
|
||||
// FIXME: Implement the spec-compliant sort order.
|
||||
|
||||
StringBuilder builder;
|
||||
auto keys = m_response_headers.keys();
|
||||
quick_sort(keys);
|
||||
|
||||
for (auto& key : keys) {
|
||||
builder.append(key);
|
||||
builder.append(": ");
|
||||
builder.append(m_response_headers.get(key).value());
|
||||
builder.append("\r\n");
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue