influxdb-client-dart
influxdb-client-dart copied to clipboard
http://localhost:8086/api/v2/query?org={org} method not allowed
Describe the bug
I am using the queryService.query() to make a query and it is returning a 400 (Bad Request) with the following
{
"code": "method not allowed",
"message": "allow: OPTIONS, POST"
}
To Reproduce Steps to reproduce the behavior:
- Run an influxdb database
InfluxDB v2.7.10 (git: f302d9730c) build_date: 2024-08-16T20:19:28Z - Perform a query
var client = InfluxDBClient(
url: 'http://localhost:8086',
token: '<token>',
org: 'ORG',
bucket: 'BUCKET',
client: RemoveUserAgentClient(),
debug: true);
var queryService = client.getQueryService();
var records = await queryService.queryRaw(''' ... ''');
Expected behavior
Expect a string of records in records
Specifications:
- Client Version:
influxdb_client: ^2.10.0 - InfluxDB Version:
InfluxDB v2.7.10 (git: f302d9730c) build_date: 2024-08-16T20:19:28Z - Platform: GCP instance
Linux 6.1.0-23-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux
Additional context
I had to strip the user agent info because chrome was erroring out with unsafe header errors if I did not do that. the code for that is
class RemoveUserAgentClient extends http.BaseClient {
final http.Client _inner = http.Client();
RemoveUserAgentClient();
@override
Future<http.StreamedResponse> send(http.BaseRequest request) {
request.headers
.removeWhere((key, value) => key.toLowerCase() == 'user-agent');
return _inner.send(request);
}
}
Hi @shaktee,
Thank you for engaging with our client. Just to clarify, are you currently using the client within a web environment?
Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.
Best Regards.