Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/kd_clients/core/WebApiClient.ts>WebApiClient

Various HTTP clients for miscellaneous use.
Latest
class WebApiClient
Abstract
import { WebApiClient } from "https://deno.land/x/kd_clients@v1.0.0-preview.13/core/WebApiClient.ts";

Provides a base class for HTTP clients.

Properties

private
readonly
headers: Headers
protected
baseUrl: string

Methods

protected
buildErrorMsg(errorMessage: string, response: Response): string

Builds an error message from the given error message and response.

protected
getResponseData<T>(response: Response): Promise<T>

Gets the data from an HTTP response.

clearHeaders(): void

Clears all of the HTTP headers.

containsHeader(name: string): boolean

Returns a value indicating whether or not an HTTP header with the given name exists.

getHeader(name: string): string | null

Gets the value of an HTTP header with a name that matches the given name.

requestDELETE(url: string): Promise<Response>

Deletes a resource by performing an HTTP request using the DELETE method.

requestGET(url: string): Promise<Response>

Gets a resource by performing an HTTP request using the GET method.

requestPATCH(url: string, body: string): Promise<Response>

Updates a resource by performing an HTTP request using the PATCH method.

requestPOST(url: string, body: string | object | Uint8Array): Promise<Response>

Creates a resource by performing an HTTP request using the POST method.

requestPUT(url: string, body: string): Promise<Response>

Modifies a resource by performing an HTTP request using the PUT method.

updateOrAddHeader(name: string, value: string): void

Updates or adds an HTTP header with the given name and value.