Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FetchWrapper

This utility class contains methods and properties required to make HTTP calls using the Fetch API library and building custom response objects.

remarks

Fetch treats 4XX or 5XX response codes as successful responses. Fetch differentiates these from a 'network error' which will throw an error in the try/catch block.

Hierarchy

  • FetchWrapper

Index

Constructors

constructor

Properties

Private Readonly commonHeaders

commonHeaders: {}

Type declaration

Private Readonly deleteOptions

deleteOptions: {}

Type declaration

Private Readonly getOptions

getOptions: {}

Type declaration

Readonly token

token: string

Methods

Private handleDeleteFetch

  • handleDeleteFetch(uri: string, options: any): Promise<number>
  • HELPER METHOD FOR TESTS ONLY

    remarks

    GitLab API doesn't send back a response body on delete, it just sends back a 204 status.

    Parameters

    • uri: string
    • options: any

    Returns Promise<number>

Private handleFetch

makeDeleteRequest

makeGetRequest

  • Sends an HTTP GET request

    Parameters

    • uri: string

      The specific API endpoint to send a request to

    Returns Promise<GetResponse>

    ApiResponse subclass instance that indicates whether the call succeeded or failed

makePostRequest

  • Sends an HTTP POST request

    Parameters

    • uri: string

      The specific API endpoint to send a request to

    • qs: any

      Querystring data required by the API endpoint

    Returns Promise<PostORPutResponse>

    ApiResponse subclass instance that indicates whether the call succeeded or failed

makePutRequest

  • Sends an HTTP PUT request

    Parameters

    • uri: string

      The specific API endpoint to send a request to

    • qs: any

      Querystring data required by the API endpoint

    Returns Promise<PostORPutResponse>

    ApiResponse subclass instance that indicates whether the call succeeded or failed

Generated using TypeDoc