CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-xmlhttprequest

tessl install tessl/npm-xmlhttprequest@1.8.0

XMLHttpRequest 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%

task.mdevals/scenario-10/

Redirect Resolver

Implement a helper that issues HTTP(S) requests and automatically follows redirect responses while exposing the full redirect chain.

Capabilities

Follow basic redirects

  • Requesting a URL that responds with a 301 or 302 and a Location header returns the final 200 response body and includes both the original and final URLs in the redirect history. @test

Handle 303 method switch

  • Starting from a POST request that receives a 303 redirect, the helper retries the redirected request as a GET without a body and returns the target's 200 response text while preserving the redirect history order. @test

Preserve method for 307

  • When a POST request receives a 307 redirect, the helper repeats the POST (including its original body) to the redirected URL and returns the target's 200 response text; the redirect history lists each hop. @test

Implementation

@generates

API

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>;

Dependencies { .dependencies }

xmlhttprequest { .dependency }

Provides a browser-style HTTP request interface with automatic redirect handling.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/xmlhttprequest@1.8.x
tile.json