CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-xmlhttprequest

XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object

Overall
score

75%

Overview
Eval results
Files

task.mdevals/scenario-7/

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

Install with Tessl CLI

npx tessl i tessl/npm-xmlhttprequest

tile.json