mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibWeb: Implement '5.5. Response class' from the Fetch API :^)
This commit is contained in:
parent
9fb672e981
commit
0b52b883af
9 changed files with 449 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Bindings/RequestPrototype.h>
|
||||
#include <LibWeb/Bindings/ResponsePrototype.h>
|
||||
#include <LibWeb/Fetch/Enums.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
||||
#include <LibWeb/ReferrerPolicy/ReferrerPolicy.h>
|
||||
|
@ -257,4 +258,24 @@ Bindings::RequestRedirect to_bindings_enum(Infrastructure::Request::RedirectMode
|
|||
}
|
||||
}
|
||||
|
||||
Bindings::ResponseType to_bindings_enum(Infrastructure::Response::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case Infrastructure::Response::Type::Basic:
|
||||
return Bindings::ResponseType::Basic;
|
||||
case Infrastructure::Response::Type::CORS:
|
||||
return Bindings::ResponseType::Cors;
|
||||
case Infrastructure::Response::Type::Default:
|
||||
return Bindings::ResponseType::Default;
|
||||
case Infrastructure::Response::Type::Error:
|
||||
return Bindings::ResponseType::Error;
|
||||
case Infrastructure::Response::Type::Opaque:
|
||||
return Bindings::ResponseType::Opaque;
|
||||
case Infrastructure::Response::Type::OpaqueRedirect:
|
||||
return Bindings::ResponseType::Opaqueredirect;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue