Edit

Share via


HttpClientHandler attribute

Version: Available or changed with runtime version 15.0.

Specifies that the method is an HttpClientHandler method, which catches and handles HTTP requests in test executions.

Note

This attribute is supported only in Business Central on-premises.

Applies to

  • Method

Note

The HttpClientHandler attribute can only be set inside codeunits with the SubType property set to Test.

Syntax

Version: Available or changed with runtime version 15.0.

[HttpClientHandler]
procedure HttpClientHandler(Request: TestHttpRequestMessage; var Response: TestHttpResponseMessage) IssueOriginalRequest: Boolean;

Important

The above signature requires the HttpClientHandler method to be global. For more information, see Local and global scope in AL methods.

Arguments

Request
 Type: TestHttpRequestMessage
The HTTP request that need to be handled.

Response
 Type: TestHttpResponseMessage
The mocked response that need to be populated by the handler.

Return Values

IssueOriginalRequest
 Type: Boolean
Indicates whether to issue the original HTTP request (true) or use the mocked response (false). The default return value of the HttpClientHandler procedure is false, ensuring that external service calls are only made intentionally.

Getting started with AL
Developing extensions