XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object
Overall
score
75%
Implement a helper that issues HTTP(S) requests and automatically follows redirect responses while exposing the full redirect chain.
Location header returns the final 200 response body and includes both the original and final URLs in the redirect history. @test@generates
export interface RedirectResult {
status: number;
body: string;
history: string[];
}
export interface RequestOptions {
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
headers?: Record<string, string>;
body?: string | Buffer;
timeoutMs?: number;
}
export function requestWithRedirects(
url: string,
options?: RequestOptions
): Promise<RedirectResult>;Provides a browser-style HTTP request interface with automatic redirect handling.
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