Skip to content

feat(js): add ImpitRequest class for header inspection before sending#380

Open
barjin wants to merge 3 commits intomasterfrom
feat/request-headers-inspection
Open

feat(js): add ImpitRequest class for header inspection before sending#380
barjin wants to merge 3 commits intomasterfrom
feat/request-headers-inspection

Conversation

@barjin
Copy link
Member

@barjin barjin commented Feb 6, 2026

Adds the ability to inspect final merged headers (including browser fingerprint headers) before sending a request. This enables request signing (AWS S3, custom APIs), debugging, and dynamic logic based on generated headers.

Example usage:

const impit = new Impit({ browser: 'chrome' });

// Create request and inspect final headers
const request = new impit.Request('https://example.com', {
  headers: { 'X-Custom': 'value' }
});

// Headers include fingerprint headers (User-Agent, sec-ch-ua, etc.)
console.log([...request.headers.entries()]);

// Use for signing, then send
const signature = createSignature(request.headers);
const signedRequest = new impit.Request(request, {
  headers: { ...Object.fromEntries(request.headers), Authorization: signature }
});

await impit.fetch(signedRequest);

Also adds impit.getRequestHeaders(url, init) for simpler header inspection without creating a request object.

Closes #227

Adds the ability to inspect final merged headers (including browser
fingerprint headers) before sending a request. This enables:
- Request signing (AWS S3, custom signed APIs)
- Debugging and verification of headers
- Dynamic logic based on generated headers

New APIs:
- `impit.Request` - bound constructor for creating inspectable requests
- `impit.getRequestHeaders(url, init)` - get headers as array of tuples
- `ImpitRequest` class with `.headers` property

Closes #227
@github-actions github-actions bot added this to the 133rd sprint - Tooling team milestone Feb 6, 2026
@github-actions github-actions bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Provide a way to access final generated headers before sending the request

1 participant