Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years 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.