You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Various types in Reqwest can in theory implement Serde's Serialize and Deserialize traits but don't. This can get quite annoying when trying to let users configure various parts of HTTP requests via a JSON file. It requires many uses of #[serde(with = "...")] which gets N times more complicated when having Option<T>, HashMap<K, V>, HashSet<T>, etc.
A non-exhaustive list of Reqwest types that could implement Serialize and/or Deserialize pretty easily:
redirect::Policy, due to current implementation details, can only really implement Deserialize. If it kept track of if it was created via Policy::none/Policy::limited it could implement Serialize too
I don't currently want to implement Serialize or Deserialize on the types. I realize most of the impls would be straightforward, but I don't want to maintain that the format would stay the same.
I think an application wanting to allowing users to provide some of those as config files should define an app-specific type and format.
Various types in Reqwest can in theory implement Serde's
Serialize
andDeserialize
traits but don't. This can get quite annoying when trying to let users configure various parts of HTTP requests via a JSON file. It requires many uses of#[serde(with = "...")]
which gets N times more complicated when havingOption<T>
,HashMap<K, V>
,HashSet<T>
, etc.A non-exhaustive list of Reqwest types that could implement
Serialize
and/orDeserialize
pretty easily:HeaderMap
via converting to and fromHashMap
HeaderName
viaas_str
andFromStr
HeaderValue
viaas_str
andFromStr
redirect::Policy
, due to current implementation details, can only really implementDeserialize
. If it kept track of if it was created viaPolicy::none
/Policy::limited
it could implementSerialize
tooMethod
viaas_str
andFromStr
StatusCode
viaas_u16
,FromStr
, andTryFrom<u16>
Cookie
via the wrapped typecookie::Jar
via the wrapped typedns::Name
viaas_str
andFromStr
I'll see if I can do this myself, but since I'm not used to the internals of Reqwest or pull requests it might be a bit messy
The text was updated successfully, but these errors were encountered: