summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Fetch/Response.idl
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-09-25 19:36:30 +0100
committerLinus Groh <mail@linusgroh.de>2022-09-27 14:56:17 +0100
commit0b52b883af2989cc43b75db4835325a2c31e71d5 (patch)
treeb9a7fb6c90d589dbe4055e9dfb8855da78a0d1b9 /Userland/Libraries/LibWeb/Fetch/Response.idl
parent9fb672e9815a240fcefbd948806351c7e943922a (diff)
downloadserenity-0b52b883af2989cc43b75db4835325a2c31e71d5.zip
LibWeb: Implement '5.5. Response class' from the Fetch API :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch/Response.idl')
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Response.idl32
1 files changed, 32 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/Response.idl b/Userland/Libraries/LibWeb/Fetch/Response.idl
new file mode 100644
index 0000000000..467f7f18bb
--- /dev/null
+++ b/Userland/Libraries/LibWeb/Fetch/Response.idl
@@ -0,0 +1,32 @@
+#import <Fetch/Body.idl>
+#import <Fetch/BodyInit.idl>
+#import <Fetch/Headers.idl>
+
+[Exposed=(Window,Worker)]
+interface Response {
+ constructor(optional BodyInit? body = null, optional ResponseInit init = {});
+
+ [NewObject] static Response error();
+ [NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
+ [NewObject] static Response json(any data, optional ResponseInit init = {});
+
+ readonly attribute ResponseType type;
+
+ readonly attribute USVString url;
+ readonly attribute boolean redirected;
+ readonly attribute unsigned short status;
+ readonly attribute boolean ok;
+ readonly attribute ByteString statusText;
+ [SameObject] readonly attribute Headers headers;
+
+ [NewObject] Response clone();
+};
+Response includes Body;
+
+dictionary ResponseInit {
+ unsigned short status = 200;
+ ByteString statusText = "";
+ HeadersInit headers;
+};
+
+enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };