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

[Feature request] Auto-Capitalization of Header Keys #444

Open
epraetor-eolian opened this issue Oct 26, 2022 · 6 comments
Open

[Feature request] Auto-Capitalization of Header Keys #444

epraetor-eolian opened this issue Oct 26, 2022 · 6 comments
Labels
type/feature-request New feature or request

Comments

@epraetor-eolian
Copy link

Describe the bug

When you enter in headers in either the data source or the query panel, the header key gets capitalized and this makes the query not work if the API you are querying is on the finicky side. For instance, if there is a required header called 'required-header' it gets changed in the actual query to 'Required-Header' and this makes queries not work for an API that I am using.

When I copy the cURL text and run it in command, the query at first does not work properly, but once I remove the capitalization from this header it works fine. Not sure if this is an issue with Grafana or the plugin itself.

Steps to reproduce

Not able to share credentials for the exact API that I am using, but if you enter in either an auth header or other custom header in the datasource or panel query, and then use the query inspector to view the cURL text, you will see that those fields get capitalized.

Note: bugs will be fixed only if enough information provided to reproduce the issue

Sample Data

Provide a link for sample data, or provide sample data bellow

Screenshots

image

Version Details:

  • Grafana version : 9.2.2
  • Plugin version : 1.0.0

Additional context

Add any other context about the problem here.

@epraetor-eolian epraetor-eolian added the type/bug Something isn't working label Oct 26, 2022
@yesoreyeram
Copy link
Collaborator

Actually the plugin doesnt capitalise. Only the curl command shows capitalise. The underlying library to show curl command capitalise. It is just representative command. So It must be something else.

@epraetor-eolian
Copy link
Author

ok thanks for the response, I'll keep looking into it

@yesoreyeram
Copy link
Collaborator

I did further investigation and found I was partially wrong here in above statement. Even though the infinity plugin or grafana doesn't capialize explicitly, golang does it by default. https://pkg.go.dev/net/http#Header.Set . BTW, the http standards suggest that the HTTP header keys should be case insensitive.

somehow I can do workaround for your case but not sure how soon. Also not sure if it is worth the effort. I would suggest to fix the target system to accept case-insensitive headers to have an actual fix.

For reference:

image

@yesoreyeram yesoreyeram reopened this Oct 31, 2022
@yesoreyeram yesoreyeram changed the title [Bug] Auto-Capitalization of Header Keys [Feature request] Auto-Capitalization of Header Keys Oct 31, 2022
@yesoreyeram yesoreyeram added type/feature-request New feature or request and removed type/bug Something isn't working labels Oct 31, 2022
@epraetor-eolian
Copy link
Author

Agreed that API should be case insensitive for header names. I actually reached out to the API owners to get this implemented. Thanks for taking a second look at this - something to keep in mind that can happen but not sure if worth the effort to implement a workaround

@epraetor-eolian
Copy link
Author

One other note with the generated CURL text is that there appears to be an extra, unmatched quotation mark at the end that isn't matched. When I run in cmd it throws an error, and then when I delete this extra quote mark the command works as it should.

Not sure if you see the same thing in your generated CURL

@shahid430
Copy link

We configured infinity plugin for our application but there is no option for access key & secret key to be applied. We are using "X-Auth_token" to authenticate but the token expiry is 24 hours only, after which we need to reset the header with new token.

Could someone please provide the configuration file for secret & access key to get rid of manually entering the X-Auth-Token everyday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants