Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "superoak"

Index

Variables

Private Const FETCH_BLOCKED_PORTS

FETCH_BLOCKED_PORTS: any = new Set([1719,1720,1723,2049,3659,4045,4190,5060,5061,6000,6566,6665,6666,6667,6668,6669,6679,6697,10080,])

Ports within the below 1024-49151 range that the WHATWG Fetch Standard forbids clients from connecting to. Deno.listen binds these ports without complaint, but fetch (which SuperDeno uses under the hood) rejects requests to them since Deno 2.9.0, so they must never be picked for the ephemeral test server.

REF: https://fetch.spec.whatwg.org/#port-blocking

Functions

Private getFreeFetchablePort

  • getFreeFetchablePort(): Promise<number>
  • Finds a free port that fetch is also permitted to connect to.

    Returns Promise<number>

Private isOakApplication

  • isOakApplication(thing: any): boolean
  • Duck typing to determine if is Oak application like.

    Parameters

    • thing: any

    Returns boolean

Private random

  • random(min: number, max: number): number
  • Generates a random number between min and max

    Parameters

    • min: number
    • max: number

    Returns number

superoak

  • superoak(app: string | any, secure?: boolean): Promise<SuperDeno>
  • Takes a url string (for an already running Oak server), or an Oak Application object.

    When passing a url string, accepts an optional second argument of secure to determine whether connections should be over HTTPS (true) or HTTP (false).

    When passing an Oak Application, SuperOak will automatically handle the creation of a server, binding to a free ephemeral port and closing of the server on a call to .end().

    Parameters

    • app: string | any
    • Optional secure: boolean

    Returns Promise<SuperDeno>

Generated using TypeDoc