Table of Contents

TTMSMCPStreamableHTTPTransport.OnGetCustomHeader Event

Handler that inspects each incoming request and may reject it.

API unit family: TMS.MCP.Transport.StreamableHTTP Declaring type: TTMSMCPStreamableHTTPTransport

Syntax

OnGetCustomHeader: TTMSMCPGetCustomHeaderEvent;

Remarks

A gate on the way in rather than a way of supplying a header: setting its allow flag to False answers the request 403 and stops it before it is dispatched. It sees every request that reaches the channel, before the path, origin and token checks, so it is the place for a shared secret or any other custom header condition.

Parameters

Name Description
Sender Channel that received the request.
ARequest The request, for reading its headers and address. It is the object the channel is about to dispatch, so read it rather than modifying or freeing it.
AAllow Whether the request may proceed. It enters set to True; setting it to False rejects the request, which is answered 403 and never reaches the protocol handler.
AErrorMessage Reason for a rejection, returned to the client in the answer. Leave it empty for a generic message; it is ignored when the request is allowed.