Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

fetch

  • Send a an external request to fetch a resource. Useful for making upstream requests to a backend.

    Parameters

    • request: Request

      the as-fetch Request object to fetch.

    • fetchInit: FetchInit

      the config object to apply to the fetch request.

    Returns FastlyPendingUpstreamRequest

    FastlyPendingUpstreamRequest for the fetched resource.

getClientIpAddressBytes

  • getClientIpAddressBytes(): ArrayBuffer
  • Function to get the IP Address of the client who sent the downstream request.

    This function returns an array buffer, which will have a byteLength of 4 if IPv4, or 16 if IPv6.

    Returns ArrayBuffer

    ArrayBuffer - A byte buffer of the IPv4 or IPv6 address.

getClientIpAddressString

  • getClientIpAddressString(): string
  • Function to get the IP Address of the client who sent the downstream request.

    Returns string

    string - A string representation of the IPv4 or IPv6 address.

getClientRequest

  • Function to get the downstream request from the client. This can only be called once per execution.

    Returns Request

    an as-fetch Request Object representing the client request.

getGeolocationForIpAddress

  • Function to get Geolocation for an IP Address using the Fastly API.

    Parameters

    • ip: string

    Returns Geolocation

    FastlyGeolocation - Object representing the geolocation of the IP Address.

getLogEndpoint

  • Create a logging endpoint as a part of the Fetchly endpoint.

    Parameters

    • endpointName: string

      Name of the endpoint to log to.

    Returns LogEndpoint

    LogEndpoint for the endpoint name.

respondWith

  • respondWith(response: Response, fastlyResponseConfigOrNull?: FastlyResponseConfig | null): void
  • Send a response back downstream to the client. This is meant for sending a completed response. For streaming a response, use {@linkcode Fetchly.respondWithStreaming}

    Parameters

    • response: Response

      The as-fetch response object representing what to respond with

    • fastlyResponseConfigOrNull: FastlyResponseConfig | null = null

    Returns void

respondWithStreaming

  • Send a response back down to the client and return a stream to continue writing to the body. If you don't need to stream the response, use {@linkcode Fetchly.respondWith}

    Parameters

    • response: Response

      The as-fetch Response object representing what to respond with.

    • fastlyResponseConfigOrNull: FastlyResponseConfig | null = null

    Returns WriteableBodyStream

    WriteableBodyStream so that you can continue writing to the body.

Legend

Generated using TypeDoc