Skip to main content
Module

x/httpclient/mod.ts>HttpClientThenableResponse

Fetch based modern http client, supports node, web, deno!
Latest
class HttpClientThenableResponse
implements Promise<T>
import { HttpClientThenableResponse } from "https://deno.land/x/httpclient@0.0.1/mod.ts";

Chainable and Lazy response object WARNING!! This object is not Promise class but implements Promise

Examples

// This won't be requested const a = new HttpClientThenableResponse(...) // One of below will send a http request await a a.then(...) a.json()

Constructors

new
HttpClientThenableResponse(c: Ctx, rp: Promise<void>)

Type Parameters

T
Ctx extends CtxBase

Properties

private
_ctx: Ctx

context

private
_rp: Promise<void>

request promise

readonly
[Symbol.toStringTag]

Methods

private
_dofetch()

Send a request with fetch

private
_ivkrm()

Invoke response middlewares

binary<K extends TypedArrayCtor = Uint8ArrayConstructor>(typedArrayConstructor?: K): Promise<TypedArrayCtorToType<K>>

Binary result

catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>

Context result

finally(onfinally?: (() => void) | null): Promise<T>
json(): Promise<T>

JSON result

text(): Promise<string>

Text result

then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>