Created
March 19, 2025 16:51
-
-
Save hexchain/1b266612ac7bc217dae48526e54d225a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CachePolicy from 'http-cache-semantics'; | |
const request: CachePolicy.Request = { | |
url: 'http://example.com/a.txt', | |
method: 'GET', | |
headers: { | |
'accept-encoding': 'gzip, br, zstd' | |
} | |
}; | |
const response: CachePolicy.Response = { | |
status: 200, | |
headers: { | |
'cache-control': 'max-age=300' | |
} | |
}; | |
const policy = new CachePolicy(request, response, { shared: true }); | |
console.log(policy.toObject()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test", | |
"version": "1.0.0", | |
"scripts": { | |
"check": "tsc --noEmit" | |
}, | |
"dependencies": { | |
"http-cache-semantics": "github:kornelski/http-cache-semantics" | |
}, | |
"devDependencies": { | |
"typescript": "^5.8.2" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"allowJs": true, | |
"noImplicitAny": true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment