XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object
Overall
score
75%
Implements HTTP helpers that can deliberately send headers normally blocked by user agents when explicitly permitted by the caller.
Referer) and resolves with parsed JSON and status details. @testContent-Length header and returns the echoed length reported by the server. @test@generates
export type ForbiddenRequestOptions = {
allowForbiddenHeaders: boolean;
timeoutMs?: number;
};
export type JsonFetchResult = {
status: number;
data: unknown;
receivedHeader?: string;
};
export type PostLengthResult = {
status: number;
echoedLength: number;
responseText: string;
};
export function fetchJsonWithForbiddenHeader(
url: string,
headerName: string,
headerValue: string,
options?: ForbiddenRequestOptions
): Promise<JsonFetchResult>;
export function postWithManualLength(
url: string,
bodyText: string,
lengthOverride: number,
options?: ForbiddenRequestOptions
): Promise<PostLengthResult>;Node implementation of the XMLHttpRequest interface used to perform HTTP requests and manage header protections.
Install with Tessl CLI
npx tessl i tessl/npm-xmlhttprequestdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10