finki-main
main
|
Last change
on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
430 bytes
|
| Line | |
|---|
| 1 | const { URL, format } = require('url')
|
|---|
| 2 |
|
|---|
| 3 | // options passed to url.format() when generating a key
|
|---|
| 4 | const formatOptions = {
|
|---|
| 5 | auth: false,
|
|---|
| 6 | fragment: false,
|
|---|
| 7 | search: true,
|
|---|
| 8 | unicode: false,
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | // returns a string to be used as the cache key for the Request
|
|---|
| 12 | const cacheKey = (request) => {
|
|---|
| 13 | const parsed = new URL(request.url)
|
|---|
| 14 | return `make-fetch-happen:request-cache:${format(parsed, formatOptions)}`
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | module.exports = cacheKey
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.