tessl install tessl/npm-xmlhttprequest@1.8.0XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object
Agent Success
Agent success rate when using this tile
75%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.15x
Baseline
Agent success rate without this tile
65%
Create a small utility that performs an HTTP GET against a provided URL while exposing event-driven lifecycle hooks for observers. It should let callers attach multiple callbacks to key request stages, remove them when no longer needed, and emit a custom completion signal with summary data once the response arrives.
start is invoked, two callbacks registered for the "start" stage both run before any response data is returned, and the call resolves with the full response text. @test"completed" event is emitted to subscribed handlers carrying the final status code and body length. @test@generates
export type RequestEvent = { type: string; data?: any };
export interface RequestMonitor {
start(): Promise<string>;
abort(): void;
on(eventName: string, handler: (event: RequestEvent) => void): void;
off(eventName: string, handler: (event: RequestEvent) => void): void;
trigger(eventName: string, data?: any): void;
}
export function createRequestMonitor(
url: string,
options?: { headers?: Record<string, string> }
): RequestMonitor;Provides a browser-style HTTP request object whose event system powers the monitor's lifecycle hooks.