Skip to main content

Http Hexa Client Service (core)

Classes

HttpHexaClient

import { HttpHexaClient } from '@hexajs-dev/core';
class HttpHexaClient { ... }

Methods

delete()

delete<TResponse, TBody = unknown>(url: string, options?: HttpHexaClientRequestOptions<TBody>): Observable<TResponse>

get()

get<TResponse>(url: string, options?: HttpHexaClientQueryRequestOptions): Observable<TResponse>

head()

head<TResponse>(url: string, options?: HttpHexaClientQueryRequestOptions): Observable<TResponse>

options()

options<TResponse>(url: string, options?: HttpHexaClientQueryRequestOptions): Observable<TResponse>

patch()

patch<TResponse, TBody = unknown>(url: string, body?: TBody, options?: HttpHexaClientRequestOptions<TBody>): Observable<TResponse>

post()

post<TResponse, TBody = unknown>(url: string, body?: TBody, options?: HttpHexaClientRequestOptions<TBody>): Observable<TResponse>

put()

put<TResponse, TBody = unknown>(url: string, body?: TBody, options?: HttpHexaClientRequestOptions<TBody>): Observable<TResponse>

request()

request<TResponse>(method: HttpHexaClientMethod, url: string, options?: HttpHexaClientRequestOptions): Observable<TResponse>

HttpHexaClientError

import { HttpHexaClientError } from '@hexajs-dev/core';
class HttpHexaClientError<TBody = unknown> extends Error { ... }

Types & Interfaces

HttpHexaClientHeadersLike

import { HttpHexaClientHeadersLike } from '@hexajs-dev/core';
interface HttpHexaClientHeadersLike {
forEach?(callback: (value: string, key: string) => void): void;
entries?(): Iterable<[
string,
string
]>;
}

HttpHexaClientRequestOptions

import { HttpHexaClientRequestOptions } from '@hexajs-dev/core';
interface HttpHexaClientRequestOptions<TBody = unknown> {
body?: TBody;
headers?: HttpHexaClientHeaders;
params?: HttpHexaClientParams;
responseType?: HttpHexaClientResponseType;
withCredentials?: boolean;
credentials?: HttpHexaClientCredentials;
mode?: HttpHexaClientMode;
cache?: HttpHexaClientCache;
redirect?: HttpHexaClientRedirect;
referrer?: string;
integrity?: string;
keepalive?: boolean;
signal?: unknown;
}

HttpHexaClientResponseLike

import { HttpHexaClientResponseLike } from '@hexajs-dev/core';
interface HttpHexaClientResponseLike {
ok: boolean;
status: number;
statusText: string;
url?: string;
headers?: HttpHexaClientHeadersLike | Record<string, string>;
text?(): Promise<string>;
json?(): Promise<unknown>;
blob?(): Promise<unknown>;
arrayBuffer?(): Promise<unknown>;
formData?(): Promise<unknown>;
}

HttpHexaClientCache

import { HttpHexaClientCache } from '@hexajs-dev/core';
type HttpHexaClientCache = 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';

HttpHexaClientCredentials

import { HttpHexaClientCredentials } from '@hexajs-dev/core';
type HttpHexaClientCredentials = 'omit' | 'same-origin' | 'include';

HttpHexaClientHeaders

import { HttpHexaClientHeaders } from '@hexajs-dev/core';
type HttpHexaClientHeaders = Record<string, HttpHexaClientHeaderValue>;

HttpHexaClientHeaderValue

import { HttpHexaClientHeaderValue } from '@hexajs-dev/core';
type HttpHexaClientHeaderValue = HttpHexaClientPrimitive | readonly HttpHexaClientPrimitive[];

HttpHexaClientMethod

import { HttpHexaClientMethod } from '@hexajs-dev/core';
type HttpHexaClientMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';

HttpHexaClientMode

import { HttpHexaClientMode } from '@hexajs-dev/core';
type HttpHexaClientMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin';

HttpHexaClientParams

import { HttpHexaClientParams } from '@hexajs-dev/core';
type HttpHexaClientParams = Record<string, HttpHexaClientQueryValue>;

HttpHexaClientPrimitive

import { HttpHexaClientPrimitive } from '@hexajs-dev/core';
type HttpHexaClientPrimitive = string | number | boolean;

HttpHexaClientQueryRequestOptions

import { HttpHexaClientQueryRequestOptions } from '@hexajs-dev/core';
type HttpHexaClientQueryRequestOptions = Omit<HttpHexaClientRequestOptions, 'body'>;

HttpHexaClientQueryValue

import { HttpHexaClientQueryValue } from '@hexajs-dev/core';
type HttpHexaClientQueryValue = HttpHexaClientPrimitive | readonly HttpHexaClientPrimitive[] | null | undefined;

HttpHexaClientRedirect

import { HttpHexaClientRedirect } from '@hexajs-dev/core';
type HttpHexaClientRedirect = 'error' | 'follow' | 'manual';

HttpHexaClientResponseType

import { HttpHexaClientResponseType } from '@hexajs-dev/core';
type HttpHexaClientResponseType = 'json' | 'text' | 'blob' | 'arrayBuffer' | 'formData';