console icon indicating copy to clipboard operation
console copied to clipboard

How to consume getConsoleRequestHeaders?

Open wrd0 opened this issue 3 years ago • 2 comments
trafficstars

I see it listed in the API docs but it's not being exported in the code for public use nor is it being used anywhere other than internal use cases, am I missing something?

https://github.com/openshift/console/blob/618cb2562170df662dc0a5ae01cc4fb8858b482b/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#getconsolerequestheaders

Any help would be much appreciated thank you.

wrd0 avatar Jul 15 '22 02:07 wrd0

I would not expect you to need to use this directly if you use the various kubernetes utilities in the API, which already add these headers. This might have been exposed unintentionally.

cc @christianvogt @vojtechszocs @florkbr

spadgett avatar Jul 25 '22 18:07 spadgett

Yeah the reason this is needed/useful is when your dynamic plugin codebase use Axios instead of fetch, one could just add this "headers: getConsoleRequestHeaders()" in your axios.create({}) global configuration and you wouldn't need to change your API calls to use fetch.

I found a workaround by wrapping consoleFetch responses to output an axios-like format, like an adapter, it works but feels like a hack.

wrd0 avatar Jul 28 '22 18:07 wrd0

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Oct 27 '22 01:10 openshift-bot

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

openshift-bot avatar Nov 26 '22 08:11 openshift-bot