Table of Contents

OnBeforeHttpClientSend Event

Codeunit Web Wrapper

This event is used for tests and is raised just before the HttpClient.Send call. This is used to override the HttpClient.Send and return custom responses. Be careful when overriding this since several other features using Web Wrapper could fire the same event, i.e. only use Manual Binding for subscribers on this event.

Signature

[IntegrationEvent(false, false)]
OnBeforeHttpClientSend(pWebRequest: HttpRequestMessage; var pvResponseContent: HttpContent; var pvResponseHeaders: HttpHeaders; var pvResponseContentHeaders: HttpHeaders; var pvLastStatusCode: Integer; var pvLastReasonPhrase: Text; var pvLastIsSuccessStatusCode: Boolean; var pvLastErrorText: Text; var pvLastErrorCode: Text; var pvIsHandled: Boolean)

Parameters

pWebRequest HttpRequestMessage

The WebRequest that are about to be sent. Use this to decide if this "is your event".

var pvResponseContent HttpContent

The Response Data (with optional headers).

var pvResponseHeaders HttpHeaders

The Response Headers.

var pvResponseContentHeaders HttpHeaders

The Response Content Headers.

var pvLastStatusCode Integer

The Status Code, normally 200 for successful calls.

var pvLastReasonPhrase Text

The Reason Phrase, normally OK for successful calls.

var pvLastIsSuccessStatusCode Boolean

True if the call was successful.

var pvLastErrorText Text

The Error message, if the call fails.

var pvLastErrorCode Text

The Status Code, if the call fails.

var pvIsHandled Boolean

This should be set to 'true' if the event is handled, and HttpClient.Send should be overridden.

This documentation is generated from Smart Toolbox v27.1