-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Json: add from_bytes method, use that in 'impl FromRequest' #2244
Json: add from_bytes method, use that in 'impl FromRequest' #2244
Conversation
Signed-off-by: wayne warren <[email protected]>
Hmm, it just occurred to me that an alternative to achieve what I'm aiming for here would be to first parse the However, this would come with two problems:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few notes:
- Cloning
Bytes
does not do a deep copy, it just increases a refcount (see its documentation) serde_json
'sRawValue
type could also be used to implement what you want today, but with more memory usage (deserialize toJson<Box<RawValue>>
first, then deserializeraw_value.get()
bytes into whatever you want to inspect its contents)- If you want to echo back the original JSON as part of a larger JSON document,
&RawValue
(can be obtained from&Bytes
throughserde_json::from_slice
) andaxum_extra::ErasedJson
(to produce the response from borrowed data) are your friends
axum/src/json.rs
Outdated
/// | ||
/// An example where this would be useful would be one in which a service needs to pass through | ||
/// or otherwise preserve the exact byte representation of the request while also interrogating | ||
/// it for metadata that may be useful in determining exactly what to do with the preserved | ||
/// bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but I kinda feel like we should remove this paragraph. I worry it might be confusing or potentially misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, fair enough.
Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Jonas Platte <[email protected]>
@jplatte thanks for the info re: |
Also, I'm curious what maintainers think about potentially making a |
What’s the advantage to having such a generic implementation? Do you have a concrete use case in mind where you need to be generic over multiple types? My initial reaction is that we probably don’t need it and that it might make things harder. |
Is there anything other than And it probably makes less sense to preserve the byte representation of a Form than it does a Json body. My thinking was that making a |
I definitely get the "that sounds too complicated to maintain" aspect so I'm not trying to push for it, just suggesting with no vested interest in getting a "yes" out of you :) |
Yaml, protobuf, string, or basically any other format would require that. I don’t think we should add any generic impls like that without a concrete use case. It makes it easy to paint ourselves into a corner with overlapping impls. More generics aren’t always better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more nitpick, otherwise LGTM (but will let David decide when to merge)
Co-authored-by: Jonas Platte <[email protected]>
Thanks for getting to this so quickly! Is this something y'all are willing to merge into the v0.6.x branch also? If so, I can open a quick PR with the contents of this PR squashed and cherry-picked against it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Wanna add it to the changelog as well?
Signed-off-by: wayne warren <[email protected]>
@davidpdrsn hey, thanks for the review! Any idea when I can expect this to be included in a release? |
I’ll take another look at this week. Sorry for the delay. Been busy at work and traveling. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [axum](https://github.com/tokio-rs/axum) | workspace.dependencies | minor | `0.6.20` -> `0.7.0` | | [inquire](https://github.com/mikaelmello/inquire) | workspace.dependencies | minor | `0.6.2` -> `0.7.0` | | [reqwest](https://github.com/seanmonstar/reqwest) | dependencies | minor | `0.11.18` -> `0.12.0` | | [webbrowser](https://github.com/amodm/webbrowser-rs) | dependencies | major | `0.8.10` -> `1.0.0` | --- ### Release Notes <details> <summary>tokio-rs/axum (axum)</summary> ### [`v0.7.5`](https://github.com/tokio-rs/axum/releases/tag/axum-v0.7.5): axum - v0.7.5 [Compare Source](tokio-rs/axum@axum-v0.7.4...axum-v0.7.5) - **fixed:** Fixed layers being cloned when calling `axum::serve` directly with a `Router` or `MethodRouter` ([#​2586]) - **fixed:** `h2` is no longer pulled as a dependency unless the `http2` feature is enabled ([#​2605]) [#​2586]: tokio-rs/axum#2586 [#​2605]: tokio-rs/axum#2605 ### [`v0.7.4`](https://github.com/tokio-rs/axum/releases/tag/axum-v0.7.4): axum - v0.7.4 [Compare Source](tokio-rs/axum@axum-v0.7.3...axum-v0.7.4) - **fixed:** Fix performance regression present since axum 0.7.0 ([#​2483]) - **fixed:** Improve `debug_handler` on tuple response types ([#​2201]) - **added:** Add `must_use` attribute to `Serve` and `WithGracefulShutdown` ([#​2484]) - **added:** Re-export `axum_core::body::BodyDataStream` from axum [#​2201]: tokio-rs/axum#2201 [#​2483]: tokio-rs/axum#2483 [#​2201]: tokio-rs/axum#2201 [#​2484]: tokio-rs/axum#2484 ### [`v0.7.3`](https://github.com/tokio-rs/axum/releases/tag/axum-v0.7.3): axum - v0.7.3 [Compare Source](tokio-rs/axum@axum-v0.7.2...axum-v0.7.3) - **added:** `Body` implements `From<()>` now ([#​2411]) - **change:** Update version of multer used internally for multipart ([#​2433]) - **change:** Update tokio-tungstenite to 0.21 ([#​2435]) - **added:** Enable `tracing` feature by default ([#​2460]) - **added:** Support graceful shutdown on `serve` ([#​2398]) - **added:** `RouterIntoService` implements `Clone` ([#​2456]) [#​2411]: tokio-rs/axum#2411 [#​2433]: tokio-rs/axum#2433 [#​2435]: tokio-rs/axum#2435 [#​2460]: tokio-rs/axum#2460 [#​2398]: tokio-rs/axum#2398 [#​2456]: tokio-rs/axum#2456 ### [`v0.7.2`](https://github.com/tokio-rs/axum/releases/tag/axum-v0.7.2): axum - v0.7.2 [Compare Source](tokio-rs/axum@axum-v0.7.1...axum-v0.7.2) - **added:** Add `axum::body::to_bytes` ([#​2373]) - **fixed:** Gracefully handle accept errors in `serve` ([#​2400]) [#​2373]: tokio-rs/axum#2373 [#​2400]: tokio-rs/axum#2400 ### [`v0.7.1`](https://github.com/tokio-rs/axum/releases/tag/axum-v0.7.1): axum - v0.7.1 [Compare Source](tokio-rs/axum@axum-v0.7.0...axum-v0.7.1) - **fix**: Fix readme. ### [`v0.7.0`](https://github.com/tokio-rs/axum/releases/tag/axum-v0.7.0): axum - v0.7.0 [Compare Source](tokio-rs/axum@axum-v0.6.20...axum-v0.7.0) - **breaking:** Update public dependencies. axum now requires - [hyper](https://crates.io/crates/hyper) 1.0 - [http](https://crates.io/crates/http) 1.0 - [http-body](https://crates.io/crates/http-body) 1.0 - **breaking:** axum now requires [tower-http](https://crates.io/crates/tower-http) 0.5 - **breaking:** Remove deprecated `WebSocketUpgrade::max_send_queue` - **breaking:** The following types/traits are no longer generic over the request body (i.e. the `B` type param has been removed) ([#​1751] and [#​1789]): - `FromRequestParts` - `FromRequest` - `HandlerService` - `HandlerWithoutStateExt` - `Handler` - `LayeredFuture` - `Layered` - `MethodRouter` - `Next` - `RequestExt` - `RouteFuture` - `Route` - `Router` - **breaking:** axum no longer re-exports `hyper::Body` as that type is removed in hyper 1.0. Instead axum has its own body type at `axum::body::Body` ([#​1751]) - **breaking:** `extract::BodyStream` has been removed as `body::Body` implements `Stream` and `FromRequest` directly ([#​1751]) - **breaking:** Change `sse::Event::json_data` to use `axum_core::Error` as its error type ([#​1762]) - **breaking:** Rename `DefaultOnFailedUpdgrade` to `DefaultOnFailedUpgrade` ([#​1664]) - **breaking:** Rename `OnFailedUpdgrade` to `OnFailedUpgrade` ([#​1664]) - **breaking:** `TypedHeader` has been move to `axum-extra` ([#​1850]) - **breaking:** Removed re-exports of `Empty` and `Full`. Use `axum::body::Body::empty` and `axum::body::Body::from` respectively ([#​1789]) - **breaking:** The response returned by `IntoResponse::into_response` must use `axum::body::Body` as the body type. `axum::response::Response` does this ([#​1789]) - **breaking:** Removed the `BoxBody` type alias and its `box_body` constructor. Use `axum::body::Body::new` instead ([#​1789]) - **breaking:** Remove `RawBody` extractor. `axum::body::Body` implements `FromRequest` directly ([#​1789]) - **breaking:** The following types from `http-body` no longer implement `IntoResponse`: - `Full`, use `Body::from` instead - `Empty`, use `Body::empty` instead - `BoxBody`, use `Body::new` instead - `UnsyncBoxBody`, use `Body::new` instead - `MapData`, use `Body::new` instead - `MapErr`, use `Body::new` instead - **added:** Add `axum::extract::Request` type alias where the body is `axum::body::Body` ([#​1789]) - **added:** Add `Router::as_service` and `Router::into_service` to workaround type inference issues when calling `ServiceExt` methods on a `Router` ([#​1835]) - **breaking:** Removed `axum::Server` as it was removed in hyper 1.0. Instead use `axum::serve(listener, service)` or hyper/hyper-util for more configuration options ([#​1868]) - **breaking:** Only inherit fallbacks for routers nested with `Router::nest`. Routers nested with `Router::nest_service` will no longer inherit fallbacks ([#​1956]) - **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade` ([#​1972]) - **added:** Add `axum::extract::Query::try_from_uri` ([#​2058]) - **added:** Implement `IntoResponse` for `Box<str>` and `Box<[u8]>` (\[[#​2035](tokio-rs/axum#2035)]) - **breaking:** Simplify `MethodFilter`. It no longer uses bitflags ([#​2073]) - **fixed:** Fix bugs around merging routers with nested fallbacks ([#​2096]) - **fixed:** Fix `.source()` of composite rejections ([#​2030]) - **fixed:** Allow unreachable code in `#[debug_handler]` ([#​2014]) - **change:** axum's MSRV is now 1.66 ([#​1882]) - **added:** Implement `IntoResponse` for `(R,) where R: IntoResponse` ([#​2143]) - **changed:** For SSE, add space between field and value for compatibility ([#​2149]) - **added:** Add `NestedPath` extractor ([#​1924]) - **added:** Add `handle_error` function to existing `ServiceExt` trait ([#​2235]) - **breaking:** `impl<T> IntoResponse(Parts) for Extension<T>` now requires `T: Clone`, as that is required by the http crate ([#​1882]) - **added:** Add `axum::Json::from_bytes` ([#​2244]) - **added:** Implement `FromRequestParts` for `http::request::Parts` ([#​2328]) - **added:** Implement `FromRequestParts` for `http::Extensions` ([#​2328]) - **fixed:** Clearly document applying `DefaultBodyLimit` to individual routes ([#​2157]) [#​1664]: tokio-rs/axum#1664 [#​1751]: tokio-rs/axum#1751 [#​1762]: tokio-rs/axum#1762 [#​1789]: tokio-rs/axum#1789 [#​1835]: tokio-rs/axum#1835 [#​1850]: tokio-rs/axum#1850 [#​1868]: tokio-rs/axum#1868 [#​1882]: tokio-rs/axum#1882 [#​1924]: tokio-rs/axum#1924 [#​1956]: tokio-rs/axum#1956 [#​1972]: tokio-rs/axum#1972 [#​2014]: tokio-rs/axum#2014 [#​2021]: tokio-rs/axum#2021 [#​2030]: tokio-rs/axum#2030 [#​2058]: tokio-rs/axum#2058 [#​2073]: tokio-rs/axum#2073 [#​2096]: tokio-rs/axum#2096 [#​2140]: tokio-rs/axum#2140 [#​2143]: tokio-rs/axum#2143 [#​2149]: tokio-rs/axum#2149 [#​2157]: tokio-rs/axum#2157 [#​2235]: tokio-rs/axum#2235 [#​2244]: tokio-rs/axum#2244 [#​2328]: tokio-rs/axum#2328 </details> <details> <summary>mikaelmello/inquire (inquire)</summary> ### [`v0.7.5`](https://github.com/mikaelmello/inquire/blob/HEAD/CHANGELOG.md#075---2024-04-23) [Compare Source](mikaelmello/inquire@v0.7.4...v0.7.5) - Fix user-provided ANSI escape codes from being removed when rendering. - Introduced on 0.7.0, this regression was making it impossible to have colorised text inside the prompt. - Now ANSI escape codes are properly emitted when rendering the prompt in the terminal. ### [`v0.7.4`](https://github.com/mikaelmello/inquire/blob/HEAD/CHANGELOG.md#074---2024-03-25) [Compare Source](mikaelmello/inquire@v0.7.3...v0.7.4) - Fix unexpected behaviors of `keep_filter` option in MultiSelect prompts: - Filter input is now correcly getting reset **only when** `keep_filter == false`. - When the filter input is reset, the list of options is now correctly reset as well. Thanks [@​Swivelgames](https://github.com/Swivelgames) for reporting [#​238](mikaelmello/inquire#238). ### [`v0.7.3`](https://github.com/mikaelmello/inquire/blob/HEAD/CHANGELOG.md#073---2024-03-21) [Compare Source](mikaelmello/inquire@v0.7.2...v0.7.3) - Fix cursor occasionally blinking in unexpected places. ### [`v0.7.2`](https://github.com/mikaelmello/inquire/blob/HEAD/CHANGELOG.md#072---2024-03-17) [Compare Source](mikaelmello/inquire@v0.7.1...v0.7.2) - Pressing Ctrl+D now cancels the prompt. Thanks [@​mikecvet](https://github.com/mikecvet) for the PR! - Add support for `h` and `l` bindings when vim_mode is enabled on MultiSelect prompts, clearing or selecting all options respectively. Thanks [@​afh](https://github.com/afh) for the PR! - Fix render issue [#​233](mikaelmello/inquire#233) where cursor positioning at the end of a prompt was incorrect. Thanks [@​msrd0](https://github.com/msrd0) and [@​Sydonian](https://github.com/Sydonian) for reporting! ### [`v0.7.1`](https://github.com/mikaelmello/inquire/blob/HEAD/CHANGELOG.md#071---2024-03-10) [Compare Source](mikaelmello/inquire@v0.7.0...v0.7.1) - Fix render issue [#​228](mikaelmello/inquire#228) when using `console` crate as the terminal backend. Thanks [@​maospr](https://github.com/maospr) for reporting. ### [`v0.7.0`](https://github.com/mikaelmello/inquire/blob/HEAD/CHANGELOG.md#070---2024-02-24) [Compare Source](mikaelmello/inquire@v0.6.2...v0.7.0) ##### Breaking Changes - The Select and Multiselect Filter now scores input and is now expected to return an `Option<i64>`, making it possible to order/rank the list of options. [#​176](mikaelmello/inquire#176) `None`: Will not be displayed in the list of options. `Some(score)`: score determines the order of options, higher score, higher on the list of options. - Improved user experience on Password prompts. When there is a validation error, the input is cleared if the password is rendered using the `Hidden` display mode, matching the user expectation of having to write the password from scratch again. Thanks to [@​CM-IV](https://github.com/CM-IV) for the questions on [#​149](mikaelmello/inquire#149)! - Allow lifetime customization of RenderConfig. [#​101](mikaelmello/inquire#101). Thanks to [@​arturfast](https://github.com/arturfast) for the suggestion [#​95](mikaelmello/inquire#95). - Implement fuzzy search as default on Select and MultiSelect prompts. [#​176](mikaelmello/inquire#176) - Revamped keybindings for DateSelect. ##### Features - Add one-liner helpers for quick scripts. [#​144](mikaelmello/inquire#144). - Add new option on MultiSelect prompts to set all options to be selected by default. Thanks to [@​conikeec](https://github.com/conikeec) for the suggestion ([#​151](mikaelmello/inquire#151))! - Add new option on Select/MultiSelect prompts allowing to reset selection to the first item on filter-input changes. [#​176](mikaelmello/inquire#176) - Emacs-like keybindings added where applicable: - Ctrl-p/Ctrl-n for up/down - Ctrl-b/Ctrl-f for left/right - Ctrl-j/Ctrl-g for enter/cancel - Vim keybindings are always supported in DateSelect prompts. - Added 'with_starting_filter_input' to both Select and MultiSelect, which allows for setting an initial value to the filter section of the prompt. - Added starting_input for CustomType. [#​194](mikaelmello/inquire#194) - Added 'without_filtering' to both Select and MultiSelect, useful when you want to simplify the UX if the filter does not add any value, such as when the list is already short. - Added 'with_answered_prompt_prefix' to RenderConfig to allow customization of answered prompt prefix. - Improved rendering, with optimizations on incremental rendering and terminal resizing. ##### Fixes - Fixed typos in the code's comments. - Fixed issue where inquire, using termion, would crash when receiving piped inputs. ##### Dependency changes (some breaking) - Upgraded underlying `termion` crate from v1.5 to v2.0. - Upgraded underlying `bitflags` from v1 to v2, which affects the `Attributes` and `KeyModifiers` crates. If you use any of bitflag's methods directly, you might be affected, refer to the [bitflags changelog](https://github.com/bitflags/bitflags/releases/tag/2.0.0) for more information. - Removed `thiserror` dependency in favor of implementing `InquireError` by hand. [#​146](mikaelmello/inquire#146) - Raised MSRV to 1.66 due to requirements in downstream dependencies. - MSRV is now explicitly set in the package definition. - Replaced `lazy_static` with `once_cell` as `once_cell::sync::Lazy` is being standardized and `lazy_static` is not actively maintained anymore. - Added `fuzzy-matcher` as an optional dependency for fuzzy filtering in Select and MultiSelect prompts [#​176](mikaelmello/inquire#176) </details> <details> <summary>seanmonstar/reqwest (reqwest)</summary> ### [`v0.12.7`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0127) [Compare Source](seanmonstar/reqwest@v0.12.6...v0.12.7) - Revert adding `impl Service<http::Request<_>>` for `Client`. ### [`v0.12.6`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0126) [Compare Source](seanmonstar/reqwest@v0.12.5...v0.12.6) - Add support for `danger_accept_invalid_hostnames` for `rustls`. - Add `impl Service<http::Request<Body>>` for `Client` and `&'_ Client`. - Add support for `!Sync` bodies in `Body::wrap_stream()`. - Enable happy eyeballs when `hickory-dns` is used. - Fix `Proxy` so that `HTTP(S)_PROXY` values take precendence over `ALL_PROXY`. - Fix `blocking::RequestBuilder::header()` from unsetting `sensitive` on passed header values. ### [`v0.12.5`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0125) [Compare Source](seanmonstar/reqwest@v0.12.4...v0.12.5) - Add `blocking::ClientBuilder::dns_resolver()` method to change DNS resolver in blocking client. - Add `http3` feature back, still requiring `reqwest_unstable`. - Add `rustls-tls-no-provider` Cargo feature to use rustls without a crypto provider. - Fix `Accept-Encoding` header combinations. - Fix http3 resolving IPv6 addresses. - Internal: upgrade to rustls 0.23. ### [`v0.12.4`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0124) [Compare Source](seanmonstar/reqwest@v0.12.3...v0.12.4) - Add `zstd` support, enabled with `zstd` Cargo feature. - Add `ClientBuilder::read_timeout(Duration)`, which applies the duration for each read operation. The timeout resets after a successful read. ### [`v0.12.3`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0123) [Compare Source](seanmonstar/reqwest@v0.12.2...v0.12.3) - Add `FromStr` for `dns::Name`. - Add `ClientBuilder::built_in_webpki_certs(bool)` to enable them separately. - Add `ClientBuilder::built_in_native_certs(bool)` to enable them separately. - Fix sending `content-length: 0` for GET requests. - Fix response body `content_length()` to return value when timeout is configured. - Fix `ClientBuilder::resolve()` to use lowercase domain names. ### [`v0.12.2`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0122) [Compare Source](seanmonstar/reqwest@v0.12.1...v0.12.2) - Fix missing ALPN when connecting to socks5 proxy with rustls. - Fix TLS version limits with rustls. - Fix not detected ALPN h2 from server with native-tls. ### [`v0.12.1`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0121) [Compare Source](seanmonstar/reqwest@v0.12.0...v0.12.1) - Fix `ClientBuilder::interface()` when no TLS is enabled. - Fix `TlsInfo::peer_certificate()` being truncated with rustls. - Fix panic if `http2` feature disabled but TLS negotiated h2 in ALPN. - Fix `Display` for `Error` to not include its source error. ### [`v0.12.0`](https://github.com/seanmonstar/reqwest/blob/HEAD/CHANGELOG.md#v0120) [Compare Source](seanmonstar/reqwest@v0.11.27...v0.12.0) - Upgrade to `hyper`, `http`, and `http-body` v1. - Add better support for converting to and from `http::Request` and `http::Response`. - Add `http2` optional cargo feature, default on. - Add `charset` optional cargo feature, default on. - Add `macos-system-configuration` cargo feature, default on. - Change all optional dependencies to no longer be exposed as implicit features. - Add `ClientBuilder::interface(str)` to specify the local interface to bind to. - Experimental: disables the `http3` feature temporarily. #### v0.11.27 - Add `hickory-dns` feature, deprecating `trust-dns`. - (wasm) Fix `Form::text()` to not set octet-stream for plain text fields. #### v0.11.26 - Revert `system-configuration` upgrade, which broke MSRV on macOS. #### v0.11.25 - Fix `Certificate::from_pem_bundle()` parsing. - Fix Apple linker errors from detecting system proxies. #### v0.11.24 - Add `Certificate::from_pem_bundle()` to add a bundle. - Add `http3_prior_knowledge()` to blocking client builder. - Remove `Sync` bounds requirement for `Body::wrap_stream()`. - Fix HTTP/2 to retry `REFUSED_STREAM` requests. - Fix instances of converting `Url` to `Uri` that could panic. #### v0.11.23 - Add `Proxy::custom_http_auth(val)` for setting the raw `Proxy-Authorization` header when connecting to proxies. - Fix redirect to reject locations that are not `http://` or `https://`. - Fix setting `nodelay` when TLS is enabled but URL is HTTP. - (wasm) Add `ClientBuilder::user_agent(val)`. - (wasm) add `multipart::Form::headers(headers)`. #### v0.11.22 - Fix compilation on Windows when `trust-dns` is enabled. #### v0.11.21 - Add automatically detecting macOS proxy settings. - Add `ClientBuilder::tls_info(bool)`, which will put `tls::TlsInfo` into the response extensions. - Fix trust-dns resolver from possible hangs. - Fix connect timeout to be split among multiple IP addresses. #### v0.11.20 - Fix `deflate` decompression back to using zlib, as outlined in the spec. #### v0.11.19 - Add `ClientBuilder::http1_ignore_invalid_headers_in_responses()` option. - Add `ClientBuilder::http1_allow_spaces_after_header_name_in_responses()` option. - Add support for `ALL_PROXY` environment variable. - Add support for `use_preconfigured_tls` when combined with HTTP/3. - Fix `deflate` decompression from using the zlib decoder. - Fix `Response::{text, text_with_charset}()` to strip BOM characters. - Fix a panic when HTTP/3 is used if UDP isn't able to connect. - Fix some dependencies for HTTP/3. - Increase MSRV to 1.63. #### v0.11.18 - Fix `RequestBuilder::json()` method from overriding a previously set `content-type` header. An existing value will be left in place. - Upgrade internal dependencies for rustls and compression. #### v0.11.17 - Upgrade internal dependencies of Experimental HTTP/3 to use quinn v0.9 - (wasm) Fix blob url support #### v0.11.16 - Chore: set MSRV in `Cargo.toml`. - Docs: fix build on docs.rs #### v0.11.15 - Add `RequestBuilder` methods to split and reconstruct from its parts. - Add experimental HTTP/3 support. - Fix `connection_verbose` to log `write_vectored` calls. - (wasm) Make requests actually cancel if the future is dropped. #### v0.11.14 - Adds `Proxy::no_proxy(url)` that works like the NO_PROXY environment variable. - Adds `multipart::Part::headers(headers)` method to add custom headers. - (wasm) Add `Response::bytes_stream()`. - Perf: several internal optimizations reducing copies and memory allocations. #### v0.11.13 - Add `ClientBuilder::dns_resolver()` option for custom DNS resolvers. - Add `ClientBuilder::tls_sni(bool)` option to enable or disable TLS Server Name Indication. - Add `Identity::from_pkcs8_pem()` constructor when using `native-tls`. - Fix `redirect::Policy::limited(0)` from following any redirects. #### v0.11.12 - Add `ClientBuilder::resolve_to_addrs()` which allows a slice of IP addresses to be specified for a single host. - Add `Response::upgrade()` to await whether the server agrees to an HTTP upgrade. #### v0.11.11 - Add HTTP/2 keep-alive configuration methods on `ClientBuilder`. - Add `ClientBuilder::http1_allow_obsolete_multiline_headers_in_responses()`. - Add `impl Service<Request>` for `Client` and `&'_ Client`. - (wasm) Add `RequestBuilder::basic_auth()`. - Fix `RequestBuilder::header` to not override `sensitive` if user explicitly set on a `HeaderValue`. - Fix rustls parsing of elliptic curve private keys. - Fix Proxy URL parsing of some invalid targets. #### v0.11.10 - Add `Error::url()` to access the URL of an error. - Add `Response::extensions()` to access the `http::Extensions` of a response. - Fix `rustls-native-certs` to log an error instead of panicking when loading an invalid system certificate. - Fix passing Basic Authorization header to proxies. #### v0.11.9 - Add `ClientBuilder::http09_responses(bool)` option to allow receiving HTTP/0.9 responses. - Fix HTTP/2 to retry requests interrupted by an HTTP/2 graceful shutdown. - Fix proxy loading from environment variables to ignore empty values. #### v0.11.8 - Update internal webpki-roots dependency. #### v0.11.7 - Add `blocking::ClientBuilder::resolve()` option, matching the async builder. - Implement `From<tokio::fs::File>` for `Body`. - Fix `blocking` request-scoped timeout applying to bodies as well. - (wasm) Fix request bodies using multipart vs formdata. - Update internal `rustls` to 0.20. #### v0.11.6 - (wasm) Fix request bodies more. #### v0.11.5 - Add `ClientBuilder::http1_only()` method. - Add `tls::Version` type, and `ClientBuilder::min_tls_version()` and `ClientBuilder::max_tls_version()` methods. - Implement `TryFrom<Request>` for `http::Request`. - Implement `Clone` for `Identity`. - Fix `NO_PROXY`environment variable parsing to more closely match curl's. Comma-separated entries are now trimmed for whitespace, and `*` is allowed to match everything. - Fix redirection to respect `https_only` option. - (wasm) Add `Body::as_bytes()` method. - (wasm) Fix sometimes wrong conversation of bytes into a `JsValue`. - (wasm) Avoid dependency on serde-serialize feature. #### v0.11.4 - Add `ClientBuilder::resolve()` option to override DNS resolution for specific domains. - Add `native-tls-alpn` Cargo feature to use ALPN with the native-tls backend. - Add `ClientBuilder::deflate()` option and `deflate` Cargo feature to support decoding response bodies using deflate. - Add `RequestBuilder::version()` to allow setting the HTTP version of a request. - Fix allowing "invalid" certificates with the `rustls-tls` backend, when the server uses TLS v1.2 or v1.3. - (wasm) Add `try_clone` to `Request` and `RequestBuilder` #### v0.11.3 - Add `impl From<hyper::Body> for reqwest::Body`. - (wasm) Add credentials mode methods to `RequestBuilder`. #### v0.11.2 - Add `CookieStore` trait to customize the type that stores and retrieves cookies for a session. - Add `cookie::Jar` as a default `CookieStore`, easing creating some session cookies before creating the `Client`. - Add `ClientBuilder::http2_adaptive_window()` option to configure an adaptive HTTP2 flow control behavior. - Add `ClientBuilder::http2_max_frame_size()` option to adjust the maximum HTTP2 frame size that can be received. - Implement `IntoUrl` for `String`, making it more convenient to create requests with `format!`. #### v0.11.1 - Add `ClientBuilder::tls_built_in_root_certs()` option to disable built-in root certificates. - Fix `rustls-tls` glue to more often support ALPN to upgrade to HTTP/2. - Fix proxy parsing to assume `http://` if no scheme is found. - Fix connection pool idle reaping by enabling hyper's `runtime` feature. - (wasm) Add `Request::new()` constructor. </details> <details> <summary>amodm/webbrowser-rs (webbrowser)</summary> ### [`v1.0.1`](https://github.com/amodm/webbrowser-rs/blob/HEAD/CHANGELOG.md#101---2024-05-06-a-name101a) [Compare Source](amodm/webbrowser-rs@v1.0.0...v1.0.1) ##### Added - Support for visionOS. See PR [#​86](amodm/webbrowser-rs#86) and [#​87](amodm/webbrowser-rs#87) ### [`v1.0.0`](https://github.com/amodm/webbrowser-rs/blob/HEAD/CHANGELOG.md#100---2024-04-20-a-name100a) [Compare Source](amodm/webbrowser-rs@v0.8.15...v1.0.0) ##### Added - Move to 1.0! MSRV has now been defined too. ##### Fixed - Unix: default to standard unix implementation, instead of whitelisting each flavour of unix - WASM: return an error on dry_run if window object isn't available </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNjAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjQyNC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Reviewed-on: https://git.front.kjuulh.io/kjuulh/coffee/pulls/14
I find this necessary in order to both deserialize the body of my service's
request into a
Json<T>
AND preserve the exact byte representation of theinput. The risk of not taking this approach for me is that the spec I am
implementing expects the exact byte representation to be preserved in order to
later serve the exact same content back to the client without a potentially
lossy serialized-deserialized-serialized transformation.
I could almost certainly deserialize these request bodies without the
Json<T>
but I really would like to take advantage of the error reporting it offers.
Signed-off-by: wayne warren [email protected]
Motivation
Solution