API
  • 30 Oct 2023
  • Dark
    Light

API

  • Dark
    Light

Article Summary

createEnforcedRequestHandler()

A function that returns a default request handler with built-in HUMAN enforcement. Useful if there is little request/response manipulation in your Edgio Edge Function.

createEnforcedRequestHandler(
    config: HumanSecurityConfiguration,
    onPass: (request: Request) => Response | Promise<Response>,
    onResponse?: (response: Response) => Response | Promise<Response>,
) => ((request: Request, context: Context) => Promise<Response>)

HumanSecurity

constructor

Creates a new instance of the HumanSecurity class from a HumanSecurityConfiguration object (see the configuration section for more information).

constructor(params: HumanSecurityConfiguration) => HumanSecurity
  • Parameters
    • params: ConfigurationParams
  • Returns a new instance of the HumanSecurity class

createEnforcer()

Creates a new Enforcer instance.

createEnforcer() => Enforcer
  • Returns a new Enforcer instance with the configurations provided to the HumanSecurity instance

Enforcer

The entity responsible for performing HUMAN enforcement.

enforce()

Executes the enforcement functionality, returning either a response or null depending on which action should be taken.

enforce(request: Request, context: Context) => Promise<Response | null>

postEnforce()

Performs any post-enforcement processing actions and final modifications to (i.e., setting cookies or headers on) the response if needed.

postEnforce(response: Response) => Promise<void>
  • Parameters
  • Returns a Promise resolving to void

Was this article helpful?

What's Next