influxdata / influxdata/influxdb

The HTTP "Accept" header is interpreted in a non-standard way

Open
#14,296 9 comments 0 reactions 0 assignees View on GitHub
1.x
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

InfluxDB does not seem to interpret the [Accept HTTP header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) according to the HTTP specification. It seems to return a MessagePack encoded response only when the header has the exact value `application/x-msgpack`. Adding a second accepted format to the header makes influxdb switch back to returning JSON.

__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.

1. Install influx
2. From a terminal, run
```sh
curl -G 'http://localhost:8086/query' --data-urlencode 'q=SHOW databases' --header "Accept: application/x-msgpack, text/plain"
```

__Expected behavior:__
A MessagePack response is returned.

__Actual behavior:__
A JSON response is returned.

__Environment info:__

* InfluxDB version: InfluxDB vv1.7.6 (git: master 01c8dd416270f424ab0c40f9291e269ac6921964)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the curl request against InfluxDB v1.7.6 and compare the response for a single Accept value versus `application/x-msgpack, text/plain`. Trace the HTTP query endpoint's Accept-header handling; done means a header listing multiple accepted formats still selects MessagePack when it is supported, with regression coverage for the reported command.

Written by the indexing model from the issue text.

Assessment

Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.