xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

PWA & Fetch API & opaque response All In One

PWA & Fetch API & opaque response All In One

opaque response / 不透明响应

PWA

https://web.dev/learn/pwa/caching/#cross-domain-requests-and-opaque-responses

Fetch API

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

FetchEvent

https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith

opaque response

[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);

  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" };

https://fetch.spec.whatwg.org/#concept-filtered-response-opaque

https://developer.mozilla.org/en-US/docs/Web/API/Response

https://fetch.spec.whatwg.org/#response-class

refs



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-04-25 23:08  xgqfrms  阅读(44)  评论(0编辑  收藏  举报