microsoft / microsoft/ApplicationInsights-JS
[Feature Request] Provide an override option for the Sender
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 685
- Forks
- 261
- Avg merge
- 21h 33m
- Merged PRs (30d)
- 5
Description
Proposal: Port over the IXhrOverride interfaces to allow the replacing of the sending logic
/**
* SendPOSTFunction type defines how an HTTP POST request is sent to an ingestion server
* @param payload - The payload object that should be sent, contains the url, bytes/string and headers for the request
* @param oncomplete - The function to call once the request has completed whether a success, failure or timeout
* @param sync - A boolean flag indicating whether the request should be sent as a synchronous request.
*/
export type SendPOSTFunction = (payload: IPayloadData, oncomplete: (status: number, headers: {
[headerName: string]: string;
}, response?: string) => void, sync?: boolean) => void;
/**
* The IXHROverride interface overrides the way HTTP requests are sent.
*/
export interface IXHROverride {
/**
* This method sends data to the specified URI using a POST request. If sync is true,
* then the request is sent synchronously. The oncomplete function should always be called after the request is
* completed (either successfully or timed out or failed due to errors).
*/
sendPOST: SendPOSTFunction;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Sender entry point and the existing HTTP sending logic, then compare it with the proposed SendPOSTFunction and IXHROverride interfaces. Trace how POST completion, status, headers, responses, synchronous requests, failures, and timeouts are handled. Done means callers can provide an override that replaces the default sending logic while preserving completion behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100