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

fix(influxql): set correct Content-Type on v1 query responses #20565

Merged
merged 11 commits into from
Jan 22, 2021

Conversation

danxmoran
Copy link
Contributor

@danxmoran danxmoran commented Jan 20, 2021

Closes #20514

See reasoning for this approach in the issue.

@danxmoran danxmoran marked this pull request as ready for review January 21, 2021 17:55
Copy link
Contributor

@stuartcarnie stuartcarnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @danxmoran – I'd caution against logging the invalid accept headers to the logs, as these represent a client issue rather than a server issue. You could consider logging them as Debug level, which should be excluded from regular logs, but they are not a warning that an administrator needs to worry about.

formatString := r.Header.Get("Accept")
encodingFormat := influxql.EncodingFormatFromMimeType(formatString)
if encodingFormat == influxql.EncodingFormatUnknown {
h.Logger.Warn("request included unknown format in Accept header, using application/json", zap.String("format", formatString))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure there is value in logging invalid Accept headers. It is a client issue and could result in spamming the logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll remove it

Comment on lines +117 to +127
- in: header
name: Accept
schema:
type: string
description: Specifies how query results should be encoded in the response.
default: application/json
enum:
- application/json
- application/csv
- text/csv
- application/x-msgpack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@danxmoran danxmoran merged commit 10fcc2b into master Jan 22, 2021
@danxmoran danxmoran deleted the dm-v1-content-type-20514 branch January 22, 2021 15:31
mohammadali-seifkashani added a commit to mohammadali-seifkashani/influxdb that referenced this pull request Jan 23, 2021
fix(influxql): set correct Content-Type on v1 query responses (influxdata#20565)
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

Successfully merging this pull request may close these issues.

Wrong Content-Type in v1 query API response
2 participants