HTTP Semantics References
Redirects
- 307 Temporary Redirect — Preserves method and body (MDN, RFC 9110 §15.4.8)
- 308 Permanent Redirect — Preserves method and body (MDN, RFC 9110 §15.4.9)
- 303 See Other — Converts to GET (opt-in via
follow303) (MDN, RFC 9110 §15.4.4)
ts
redirectPolicy({ allow: [307, 308], follow303: false });Rate Limiting
- 429 Too Many Requests +
Retry-After(MDN, RFC 6585) - 503 Service Unavailable +
Retry-After(MDN, RFC 9110 §15.6.4)
ts
import { retry } from '@unireq/core';
import { httpRetryPredicate, rateLimitDelay } from '@unireq/http';
retry(
httpRetryPredicate({ statusCodes: [429, 503] }),
[rateLimitDelay({ maxWait: 60000 })],
{ tries: 3 }
);Range Requests
- 206 Partial Content — Server sends requested byte range (MDN, RFC 7233)
- 416 Range Not Satisfiable — Invalid range (MDN, RFC 7233 §4.4)
Accept-Ranges: bytes— Server supports ranges (MDN)
ts
range({ start: 0, end: 1023 }); // Request first 1KB
resume({ downloaded: 5000 }); // Resume from byte 5000Multipart Form Data
- RFC 7578 —
multipart/form-data(spec)
ts
multipart(
[{ name: 'file', filename: 'doc.pdf', data: blob, contentType: 'application/pdf' }],
[{ name: 'title', value: 'My Document' }]
);OAuth 2.0 Bearer
- RFC 6750 — Bearer token usage (spec)
ts
oauthBearer({
tokenSupplier: async () => getAccessToken(),
skew: 60, // Clock skew tolerance (seconds)
autoRefresh: true // Refresh on 401
});