Defjs
Core

makeResponse

Builds an HttpResponse without a network call, for interceptors that short-circuit next and for tests.

@defjs/core · Function

Signature

function makeResponse<R>(
  options?: MakeResponseOptions<R>,
): HttpResponse<R>;

Default status is 0, so pass a 2xx status for a success. ok is true for 2xx. The value it returns goes through the same media-type check and the same declared struct as one off the wire; there is no trusted short-circuit. For a JSON body, set a JSON content-type header.

Parameters

Prop

Type

options? MakeResponseOptions<R>

Status, headers, body, and an optional request to copy headers/url from; defaults yield status 0.

Returns

An HttpResponse with ok derived from the status code.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao