createPartialResponse.d.ts 923 B

123456789101112131415161718192021
  1. import './_version.js';
  2. /**
  3. * Given a `Request` and `Response` objects as input, this will return a
  4. * promise for a new `Response`.
  5. *
  6. * If the original `Response` already contains partial content (i.e. it has
  7. * a status of 206), then this assumes it already fulfills the `Range:`
  8. * requirements, and will return it as-is.
  9. *
  10. * @param {Request} request A request, which should contain a Range:
  11. * header.
  12. * @param {Response} originalResponse A response.
  13. * @return {Promise<Response>} Either a `206 Partial Content` response, with
  14. * the response body set to the slice of content specified by the request's
  15. * `Range:` header, or a `416 Range Not Satisfiable` response if the
  16. * conditions of the `Range:` header can't be met.
  17. *
  18. * @memberof module:workbox-range-requests
  19. */
  20. declare function createPartialResponse(request: Request, originalResponse: Response): Promise<Response>;
  21. export { createPartialResponse };