Response.idl 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #import <Fetch/Body.idl>
  2. #import <Fetch/BodyInit.idl>
  3. #import <Fetch/Headers.idl>
  4. // https://fetch.spec.whatwg.org/#response-class
  5. [Exposed=(Window,Worker)]
  6. interface Response {
  7. constructor(optional BodyInit? body = null, optional ResponseInit init = {});
  8. [NewObject] static Response error();
  9. [NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
  10. [NewObject] static Response json(any data, optional ResponseInit init = {});
  11. readonly attribute ResponseType type;
  12. readonly attribute USVString url;
  13. readonly attribute boolean redirected;
  14. readonly attribute unsigned short status;
  15. readonly attribute boolean ok;
  16. readonly attribute ByteString statusText;
  17. [SameObject] readonly attribute Headers headers;
  18. [NewObject] Response clone();
  19. };
  20. Response includes Body;
  21. dictionary ResponseInit {
  22. unsigned short status = 200;
  23. ByteString statusText = "";
  24. HeadersInit headers;
  25. };
  26. enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };