Skip to main content

DenchRunner

Summary

An interface that defines runner methods for executing a configured request and returning the response in the desired format.

Type Definition

interface DenchRunner<T> {
toResponse: () => Promise<Response>;
toJson: () => Promise<T>;
toFormData: () => Promise<FormData>;
}

Generics

GenericDescription
TThe TypeScript type of the JSON response returned by toJson(). No runtime validation is performed.

Properties

PropertyTypeRequiredDescription
toResponse() => Promise<Response>YesExecutes the request and returns the native Response.
toJson() => Promise<T>YesExecutes the request and parses the response as JSON.
toFormData() => Promise<FormData>YesExecutes the request and parses the response as FormData.

Used By

  • Extended by DenchCreateBuilder<T>.
  • Extended by DenchGetBuilder<T>.
  • Defines the toResponse(), toJson(), and toFormData() APIs for all request builders.
import type { DenchRunner } from 'dench-fetch';