@hugoalh/http-header-retry-after
v1.3.1
Published
A module to handle the HTTP header `Retry-After` according to the specification RFC 9110.
Maintainers
Readme
HTTP Header Retry-After (ES)
🔗 DistBoard @hugoalh ● GitHub ● JSR ● NPM
An ECMAScript module to handle the HTTP header Retry-After according to the specification RFC 9110.
🎯 Runtime Targets
Any runtime which support ECMAScript should able to use this; These runtimes are officially supported:
🛡️ Runtime Permissions
This does not request any runtime permission.
#️⃣ Sources & Entrypoints
- GitHub Raw
https://raw.githubusercontent.com/hugoalh/http-header-retry-after-es/{Tag}/mod.ts - JSR
jsr:@hugoalh/http-header-retry-after[@{Tag}] - NPM
npm:@hugoalh/http-header-retry-after[@{Tag}]
| Name | Path | Description |
|:--|:--|:--|
| . | ./mod.ts | Default. |
[!NOTE]
- Different runtimes have vary support for the sources and entrypoints, visit the runtime documentation for more information.
- It is recommended to include tag for immutability.
- These are not part of the public APIs hence should not be used:
- Benchmark/Test file (e.g.:
example.bench.ts,example.test.ts).- Entrypoint name or path include any underscore prefix (e.g.:
_example.ts,foo/_example.ts).- Identifier/Namespace/Symbol include any underscore prefix (e.g.:
_example,Foo._example).
🧩 APIs
class HTTPHeaderRetryAfter { constructor(input: number | string | Date | Headers | Response); getDate(): Date; getRemainTimeMilliseconds(): number; getRemainTimeSeconds(): number; stringify(): string; toString(): string; static parseSafe(input: number | string | Date | Headers | Response): HTTPHeaderRetryAfter | null; }
[!NOTE]
- For the full or prettier documentation, can visit via:
✍️ Examples
new HTTPHeaderRetryAfter("Wed, 21 Oct 2015 07:28:00 GMT").getRemainTimeMilliseconds(); //=> 0new HTTPHeaderRetryAfter("120");
