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

Blocking Config Bootstrapper

Ensures configuration values are fetched in a blocking manner before application startup continues.

Capabilities

Retrieves config synchronously

  • Given a URL returning status 200 with JSON payload { "feature": "on" }, returns a result containing status 200, body text, and a parsed data object while blocking until the response is fully available. @test
  • When the remote responds with status 503 and body maintenance, returns a result reflecting status 503 and the raw body instead of throwing a generic error, still using a blocking request. @test

Posts payload synchronously

  • When sending a JSON string payload to an endpoint that echoes the body, returns status 200 and the echoed body while performing the request synchronously. @test

Orders sequential startup calls

  • When provided two URLs, executes both requests one after another and preserves result order (first response corresponds to first URL) before returning the array of results. @test

Implementation

@generates

API

export interface SyncResponse {
  status: number;
  body: string;
  data?: unknown;
}

export function fetchConfigSync(url: string, headers?: Record<string, string>): SyncResponse;
export function postConfigSync(url: string, payload: string, headers?: Record<string, string>): SyncResponse;
export function fetchAllSync(urls: string[], headers?: Record<string, string>): SyncResponse[];

Dependencies { .dependencies }

xmlhttprequest { .dependency }

Provides blocking HTTP(S) requests using a browser-compatible client, including synchronous mode suitable for boot-time flows. @satisfied-by

Version

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