bcquality/microsoft/knowledge/web-services/handle-httpclient-platform-failure-before-response-access.md
Stefano Demiliani 4287233f80
Strengthen review contracts and add AL reliability guidance (#196)
* Strengthen review contracts and HTTP guidance

- add outbound HttpClient transport and HTTP status review rules with paired fixtures`n- resolve layered action-skill overrides deterministically across enabled layers`n- validate findings reports and enforce measurable changed-fixture coverage

* Add data handling and test isolation guidance

- add SCM guidance for deriving base quantities through line unit-of-measure validation`n- add security guidance for parameterizing SetFilter with external text`n- add test isolation guidance for resetting per-test state before initialization guards`n- add web-service guidance for JSON null handling and invariant standard format 9`n- route and cover all five rules with paired evaluation fixtures

* Fix findings report rollup validation

* Validate findings report rollups

* Enforce merged finding identity

* Fix locationless finding deduplication

* Reject conflicting merged corrections

* Detect conflicting leaf corrections

* Route HTTP error checks to canonical web-services knowledge

Let the Error Handling leaf conditionally retrieve the existing HTTP owner articles, preserving applicability and exact-path provenance. Add deterministic source-contract and retrieval regressions without duplicating knowledge rules.

Copilot-Session-Id: a92a7788-103e-4651-9b84-19e34caffb94

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: wenjiefan <wenjiefan@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
2026-09-29 13:03:39 +02:00

2 KiB

bc-version domain keywords technologies countries application-area
all
web-services
httpclient
transport-failure
boolean-return
httpresponsemessage
content
runtime-error
al
w1
all

Handle HttpClient platform failure before accessing the response

Description

AL HttpClient methods can fail before a usable HTTP response exists because of an invalid request, DNS or network failure, certificate validation, timeout, a disabled extension setting, or the response-size limit. When code captures the optional Boolean return value, false reports this platform or transport failure. The accompanying HttpResponseMessage is not safe to consume; accessing its content after the failed call can raise another error and obscure the original failure.

Best Practice

When capturing the Boolean return value from Get, Post, Put, Delete, or Send, stop the current response-processing path immediately when it is false. Report or propagate the transport failure without reading status, headers, or content. Omitting the optional Boolean is also valid when fail-fast behavior is intended: the runtime then raises an error if the operation cannot execute.

See sample: handle-httpclient-platform-failure-before-response-access.good.al.

Anti Pattern

Capturing a failed call in a Boolean and then reading Response.Content(), parsing the body, or otherwise treating Response as usable. Do not report omission of the Boolean by itself; that form deliberately delegates failure propagation to the runtime.

See sample: handle-httpclient-platform-failure-before-response-access.bad.al.

References