# Class Http

Utility class for making HTTP requests. If requests are made to the Twinfinity backend then correct headers are automatically set.

##### Index

### Constructors

constructor

### Methods

delete
fetch
get
patch
post
put
setAuthorizationHeaderProvider

## Constructors

### constructor

- new Http(): Http

  #### Returns Http

## Methods

### `Static` delete

- delete<R>(
  absoluteUrl: string | URL,
  responseconverter: (r: Response) => TypedResponse<R>,
  init?: HttpRequestInit,
  ): Promise<TypedResponse<R>>

  Issues a DELETE HTTP request

  #### Type Parameters

  - R

  #### Parameters

  - absoluteUrl: string | URL

    Absolute url

  - responseconverter: (r: Response) => TypedResponse<R>

    How response should be converted. Use functions on HttpResponseType

  - `Optional` init: HttpRequestInit

    Optional HttpRequestInit values.

  #### Returns Promise<TypedResponse<R>>

### `Static` fetch

- fetch<R>(
  method: HttpMethod,
  absoluteUrl: string | URL,
  responseconverter: (r: Response) => TypedResponse<R>,
  init?: HttpRequestInit,
  ): Promise<TypedResponse<R>>

  Issues a HTTP request

  #### Type Parameters

  - R

  #### Parameters

  - method: HttpMethod

    Method of http request.

  - absoluteUrl: string | URL

    Absolute url

  - responseconverter: (r: Response) => TypedResponse<R>

    How response should be converted. Use functions on HttpResponseType

  - `Optional` init: HttpRequestInit

    Optional HttpRequestInit values.

  #### Returns Promise<TypedResponse<R>>

### `Static` get

- get<R>(
  absoluteUrl: string | URL,
  responseconverter: (r: Response) => TypedResponse<R>,
  init?: HttpRequestInit,
  ): Promise<TypedResponse<R>>

  Issues a GET HTTP request

  #### Type Parameters

  - R

  #### Parameters

  - absoluteUrl: string | URL

    Absolute url

  - responseconverter: (r: Response) => TypedResponse<R>

    How response should be converted. Use functions on HttpResponseType

  - `Optional` init: HttpRequestInit

    Optional HttpRequestInit values.

  #### Returns Promise<TypedResponse<R>>

### `Static` patch

- patch<R>(
  absoluteUrl: string | URL,
  responseconverter: (r: Response) => TypedResponse<R>,
  init?: HttpRequestInit,
  ): Promise<TypedResponse<R>>

  Issues a PATCH HTTP request

  #### Type Parameters

  - R

  #### Parameters

  - absoluteUrl: string | URL

    Absolute url

  - responseconverter: (r: Response) => TypedResponse<R>

    How response should be converted. Use functions on HttpResponseType

  - `Optional` init: HttpRequestInit

    Optional HttpRequestInit values.

  #### Returns Promise<TypedResponse<R>>

### `Static` post

- post<R>(
  absoluteUrl: string | URL,
  responseconverter: (r: Response) => TypedResponse<R>,
  init?: HttpRequestInit,
  ): Promise<TypedResponse<R>>

  Issues a POST HTTP request

  #### Type Parameters

  - R

  #### Parameters

  - absoluteUrl: string | URL

    Absolute url

  - responseconverter: (r: Response) => TypedResponse<R>

    How response should be converted. Use functions on HttpResponseType

  - `Optional` init: HttpRequestInit

    Optional HttpRequestInit values.

  #### Returns Promise<TypedResponse<R>>

### `Static` put

- put<R>(
  absoluteUrl: string | URL,
  responseconverter: (r: Response) => TypedResponse<R>,
  init?: HttpRequestInit,
  ): Promise<TypedResponse<R>>

  Issues a PUT HTTP request

  #### Type Parameters

  - R

  #### Parameters

  - absoluteUrl: string | URL

    Absolute url

  - responseconverter: (r: Response) => TypedResponse<R>

    How response should be converted. Use functions on HttpResponseType

  - `Optional` init: HttpRequestInit

    Optional HttpRequestInit values.

  #### Returns Promise<TypedResponse<R>>

### `Static` setAuthorizationHeaderProvider

- setAuthorizationHeaderProvider(
  authorizationHeaderProvider: AuthorizationHeaderProvider,
  ): void

  #### Parameters

  - authorizationHeaderProvider: AuthorizationHeaderProvider

  #### Returns void