@serenity-is/corelib / serviceCall
Function: serviceCall()
serviceCall<
TResponse>(options):PromiseLike<TResponse>
Defined in: src/base/services.ts:241
Executes a Serenity service call.
Prefers fetch (async) when options.async is true (default); falls back to synchronous XMLHttpRequest when async is false (blocks the UI — avoid in new code).
Handles CSRF headers, blockUI, redirect handling, and delegates error display to the global error handler unless suppressed via errorMode or onError.
Type Parameters
TResponse
TResponse extends ServiceResponse
Service response type (extends ServiceResponse).
Parameters
options
ServiceOptions<TResponse>
Service options including service/url, request payload and callbacks.
Returns
PromiseLike<TResponse>
A PromiseLike that resolves with the parsed response on success or rejects with an enriched Error (with kind and origin === "serviceCall") on failure.