Pre-Interceptors
Docs
Modify requests before they’re sent:
bshEngine.preInterceptor(async (params) => {
// Add custom headers
params.options.headers = {
...params.options.headers,
'X-Custom-Header': 'value',
'X-Request-ID': generateRequestId()
};
// Modify request body if needed
if (params.options.body) {
// Transform body
}
// Log request
console.log(`Making ${params.options.method} request to ${params.path}`);
return params;
});Pre-interceptors receive the request parameters and can modify them before the request is sent. They must return the modified (or original) parameters.