Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "RouteFetcher"

Index

Type aliases

Variables

Functions

Type aliases

RouteFetcher

RouteFetcher<M>: {}

Use RouteFetcher(schema) to create a RouteFetcher instance.

Type parameters

Type declaration

Variables

Headers

Headers: { constructor: any; prototype: Headers }

Type declaration

  • constructor: function
    • new __type(init?: HeadersInit): Headers
    • Parameters

      • Optional init: HeadersInit

      Returns Headers

  • prototype: Headers

fetch

fetch: fetch

Functions

RouteFetcher

  • Creates a RouteFetcher instance that can be used to execute an HTTP request based on the given route schema.

    Example

    let TestRoute = await RouteFetcher(TestRouteSchema)
    let response = await TestRoute.get({
      query: {
        name: 'Simon'
      }
    })
    
    if (response.status === 200) {
      console.log(response.body.message)
    }

    Unsupported content types do not have a populated body field. Please use one of fetch's body consumption functions.

    Example

    if (response.contentType === 'application/octet-stream') {
      let buf = await response.res.arrayBuffer()
    }

    Type parameters

    Parameters

    Returns RouteFetcher<M>

Generated using TypeDoc