Description
Program panics when serde_json is built with arbitrary_precision feature
thread 'actix-server worker 0' panicked at src\http_services\api\dashboard\summary.rs:11:14:
called `Result::unwrap()` on an `Err` value: Client(ClientError { message: "failed to parse JSON response from server", source: Some(reqwest::Error { kind: Decode, source: Error("invalid type: map, expected f64", line: 0, column: 0) }) })
stack backtrace:
To reproduce
- cargo.toml
[dependencies]
serde_json = { version = "1.0.117", features = ["arbitrary_precision"] }
prometheus-http-query = { version = "0.8.3" }
- Then try querying any metric via Client::query().await
Cause
- This is due to the way serde_json handles numeric values with “arbitrary_precision” feature.
- The current logic forces serde_json to cast the String type to Float64:
|
#[serde(deserialize_with = "de::deserialize_f64")] |
My opinion
This is a bug in the current crate.
I believe there is no need to convert String to F64, as that is the prerogative of those who really need it.
On the other hand, if contributors wish not to fix this, the correct operation of the crate with arbitrary_precision feature should be implemented.
Description
Program panics when serde_json is built with arbitrary_precision feature
To reproduce
Cause
prometheus-http-query/src/response.rs
Line 322 in 45422c0
My opinion
This is a bug in the current crate.
I believe there is no need to convert String to F64, as that is the prerogative of those who really need it.
On the other hand, if contributors wish not to fix this, the correct operation of the crate with arbitrary_precision feature should be implemented.