Fetch a URL and inspect all response headers including custom ones.
Code
Utilitiesconst response = await fetch('https://httpbin.org/response-headers?X-Custom=test&Cache-Control=max-age=3600');
const headers = {};
response.headers.forEach((value, key) => {
headers[key] = value;
});
headers;Browser·fetch() may be limited by CORS
Common Response Headers
| Header | Purpose |
|---|---|
content-type | Response format |
content-length | Size in bytes |
cache-control | Caching rules |
set-cookie | Cookie to store |
location | Redirect URL |
x-ratelimit-* | Rate limit info |
More JavaScript Snippets
Add Query Parameter
Add or update a query parameter in a URL string.
Bearer Token Authentication
Make an authenticated HTTP request using Bearer token for JWT or OAuth.
Check Cloudflare Cache Status
Check if a resource is served from Cloudflare's cache by inspecting the CF-Cache-Status header.
CORS Cross-Origin Request
Make a cross-origin HTTP request with CORS headers inspection.
Delayed Response (Test Timeouts)
Request a delayed response to test timeout handling with AbortController.
Download Binary File
Download an image or binary file and convert it to a blob or base64.