-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
I'm looking for a way to customize the DashRenderer request HTTP headers, mainly for authentication purposes. There's a thread on the community forum that wasn't resolved, but otherwise I don't see any discussion, either on GitHub or on the forum. I was wondering, has there been any progress on this? And if not, would you be willing to accept help and/or help me out creating a PR for this?
It looks to me a reasonably straightforward solution would be to modify the handleServerside
callback to look something like this:
function handleServerside(
hooks: any,
config: any,
payload: any
): Promise<any> {
let rawRequest = mergeDeepRight(config.fetch, {
method: 'POST',
headers: getCSRFHeader() as any
});
if (hooks.request_pre !== null) {
hooks.request_pre(payload, rawRequest);
}
rawRequest.body = JSON.stringify(payload);
return fetch(
`${urlBase(config)}_dash-update-component`,
rawRequest
).then(...)
}
and then to modify the request_pre
hook to accept an additional parameter.
Alternatives I can think of:
- Expose only the headers as an additional parameter to the
request_pre
hook. - Expose the
config
object to a new (pre-load) hook
What are your thoughts on this?
mmonto95