Skip to main content

Function: fetchCSRFToken()

fetchCSRFToken(page, serviceUrl): Promise<CSRFTokenResult>

Defined in: src/modules/odata.ts:331

Fetches a CSRF token from an OData service using a HEAD request.

Parameters​

page​

ODataCSRFPage

Playwright Page with request API (or compatible subset).

serviceUrl​

string

The OData service root URL.

Returns​

Promise<CSRFTokenResult>

The CSRF token and service URL.

Throws​

ODataError if the token cannot be fetched.

Example​

const { token } = await fetchCSRFToken(page, '/sap/opu/odata/sap/API_PRODUCT_SRV/');