Options
All
  • Public
  • Public/Protected
  • All
Menu

External module fly/fetch/pipeline

Index

Type aliases

Functions

Type aliases

PipelineStage

PipelineStage: FetchGenerator | [FetchGenerator, any[]]

PipeplineStage can either be a FetchGenerator function, or a tuple of FetchGenerator + args.

Functions

pipeline

  • Combine multiple fetches into a single function. Allows middleware type functionality

    Example:

    `javascript import { pipeline } from "@fly/fetch/pipeline"

    const addHeader = function(fetch){ return function(req, init){ if(typeof req === "string") req = new Request(req, init) req.headers.set("Superfly-Header", "shazam") return fetch(req, init) } }

    const p = pipeline(fetch, addHeader)

    fly.http.respondWith(p)

    @param stages fetch generator functions that apply additional logic @returns a combinedfunction that can be used anywhere that wants fetch

    Parameters

    Returns pipelineFetch & object

Generated using TypeDoc