Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for setting headers for CubejsApi (cubejs-client-core) #241

Closed
ferrants opened this issue Oct 25, 2019 · 0 comments
Closed

Support for setting headers for CubejsApi (cubejs-client-core) #241

ferrants opened this issue Oct 25, 2019 · 0 comments
Milestone

Comments

@ferrants
Copy link
Contributor

ferrants commented Oct 25, 2019

Is your feature request related to a problem? Please describe.
I'm trying to integrate some testing, but this would be a problem with a front-end integrating as well. I want to set multiple headers to flow through to the USER_CONTEXT, but the client doesn't handle passing in explicit headers.

Describe the solution you'd like
Either defining in the api:

const cubejsApi = cubejs(
    process.env.supersecret,
    {
        apiUrl: 'http://localhost:4000/cubejs-api/v1',
        headers: {'user-id': 1}
    }
)

or define as part of the options for the load/sql operations:

cubejs_api.load({
        measures: ['SovSearchResultRedshiftDaily.count'],
        timeDimensions: [],
  },
  {
    'user-id': 1
  }
)

Describe alternatives you've considered
I can construct the query directly and not use the CubejsApi. @paveltiunov suggested:

As a workaround you can override HttpTransport though.

It's probably good to support this more easily and document around it.

Additional context
I don’t see anything about headers here
https://cube.dev/docs/@cubejs-client-core#cubejs-api
except maybe the options, which doesn’t appear to be documented and I don’t see anything about headers here:
https://github.com/cube-js/cube.js/blob/master/packages/cubejs-client-core/src/index.js

@paveltiunov paveltiunov added this to the v0.11.10 milestone Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants