add ability to add custom request headers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
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_prehook. - Expose the
configobject to a new (pre-load) hook
What are your thoughts on this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the DashRenderer handleServerside callback and the existing request_pre hook described in the issue. Compare the proposed ways to expose request headers or config, then define a completed design in which callers can customize headers for authenticated requests and the relevant request behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100