Interface ClientRequestInterceptor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
TestScriptEngine run.
This is deliberately generic and knows nothing about SMART, OAuth2, or any other
specific auth scheme - it is the same missing capability an HCPD sandbox integration
needed a mandatory X-Request-ID header for, worked around at the time with an
external proxy rather than a hook in the engine. Any consumer with a header-injection
need - a bearer token obtained via fhir-frog-smart's SmartAuthProvider,
a custom correlation header, or anything else - should implement this instead of
reaching for another one-off proxy workaround.
Registered via TestScriptEngine.builder().requestInterceptor(...). The default
is NOOP, so existing callers that never set one see no behaviour change. The
interceptor is registered once on the underlying HAPI IGenericClient that is
shared by every operation type (read/create/update/
delete/search/batch/transaction/history), so it
applies uniformly to all of them rather than needing to be re-wired into each one.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClientRequestInterceptorA no-op interceptor; the default when a caller does not set one. -
Method Summary
Modifier and TypeMethodDescriptionvoidintercept(ca.uhn.fhir.rest.client.api.IHttpRequest request) Mutate the outgoing HTTP request before it is sent - typically by adding a header such asAuthorizationorX-Request-ID.
-
Field Details
-
NOOP
A no-op interceptor; the default when a caller does not set one.
-
-
Method Details
-
intercept
void intercept(ca.uhn.fhir.rest.client.api.IHttpRequest request) Mutate the outgoing HTTP request before it is sent - typically by adding a header such asAuthorizationorX-Request-ID.- Parameters:
request- the outgoing request; callIHttpRequest.addHeader(java.lang.String, java.lang.String)to attach headers
-