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-5/

Forbidden Header Requester

Implements HTTP helpers that can deliberately send headers normally blocked by user agents when explicitly permitted by the caller.

Capabilities

Sends blocked header when allowed

  • Performs a GET request to the provided URL that includes the supplied forbidden header value (for example, Referer) and resolves with parsed JSON and status details. @test

Rejects forbidden header when not allowed

  • Attempting to provide a forbidden header while header overrides are disabled rejects with a descriptive error. @test

Resets header guard after override

  • After a header-override request, the next request made without override must not forward any forbidden header. @test

Manual content length override

  • Sends a POST request with a manually supplied Content-Length header and returns the echoed length reported by the server. @test

Implementation

@generates

API

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

Dependencies { .dependencies }

xmlhttprequest { .dependency }

Node implementation of the XMLHttpRequest interface used to perform HTTP requests and manage header protections.

Version

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