BinaryHTTPReceiver

BinaryHTTPReceiver

/** A class that receives binary CloudEvents over HTTP. This class can be used if you know that all incoming events will be using binary transport. If events can come as either binary or structured, use {HTTPReceiver}.

Constructor

new BinaryHTTPReceiver(version)

Creates a new BinaryHTTPReceiver to accept events over HTTP.

Parameters:
Name Type Description
version string

the Cloud Event specification version to use. Default "1.0"

Source:

Methods

check(payload, headers) → {boolean}

Checks an incoming HTTP request to determine if it conforms to the Cloud Event specification for this receiver.

Parameters:
Name Type Description
payload Object

the HTTP request body

headers Object

the HTTP request headers

Source:
Throws:

if the event does not conform to the spec

Type
ValidationError

parse(payload, headers) → {CloudEvent}

Parses an incoming HTTP request, converting it to a {CloudEvent} instance if it conforms to the Cloud Event specification for this receiver.

Parameters:
Name Type Description
payload Object

the HTTP request body

headers Object

the HTTP request headers

Source:
Throws:

of the event does not conform to the spec

Type
ValidationError