Class ActorHttp<TS>Abstract

A base actor for listening to HTTP events.

Actor types:

  • Input: IActionHttp: The HTTP request.
  • Test: IActorHttpTest: An estimate for the response time.
  • Output: IActorHttpOutput: The HTTP response.
  • IActionHttp
  • IActorHttpTest
  • IActorHttpOutput

Type Parameters

  • TS = undefined

Hierarchy (View Summary)

Constructors

Properties

Actor that must be registered in the bus before this actor.

bus: Bus<
    Actor<IActionHttp, IActorTest, IActorHttpOutput, TS>,
    IActionHttp,
    IActorTest,
    IActorHttpOutput,
    TS,
>

The bus this actor subscribes to.

name: string

The name for this actor.

{<rdf:subject>}

Methods

  • Creates an appropriate User-Agent header string for Node.js or other environments. Within browsers, returns undefined, because the value should not be overridden due to potential CORS issues.

    Parameters

    • actorName: string
    • actorVersion: string

    Returns undefined | string

  • Extract the requested URL from the action input.

    Parameters

    • input: RequestInfo | URL

      The request input.

    Returns URL

    The extracted URL.

  • Convert the given headers object into a raw hash.

    Parameters

    • headers: Headers

      A headers object.

    Returns Record<string, string>

  • Attempts to determine whether the current environment is a browser or not.

    Returns boolean

    True for browsers and web workers, false for other runtimes.

  • Converts WhatWG streams to Node streams if required. Returns the input in case the stream already is a Node stream.

    Parameters

    • body: null | ReadableStream<any>

    Returns ReadableStream

    A node stream.

  • Converts Node streams to WhatWG streams.

    Parameters

    • body: null | ReadableStream

    Returns ReadableStream<any>

    A web stream.