Function: protocolMatcher()
Function: protocolMatcher()
function protocolMatcher<IncomingEventType, OutgoingResponseType>(options): boolean;
Matches the protocol (HTTP or HTTPS) of an incoming HTTP event against a route's configuration.
Type Parameters
IncomingEventType
IncomingEventType
extends IIncomingEvent
= IIncomingEvent
The type representing the incoming HTTP event.
OutgoingResponseType
OutgoingResponseType
= unknown
The type representing the outgoing HTTP response.
Parameters
options
MatcherOptions
<IncomingEventType
, OutgoingResponseType
>
The matcher options containing the route and event.
Returns
boolean
true
if the protocol matches the route's requirements, otherwise false
.
Example
const match = protocolMatcher({ route, event });
console.log(match); // true or false