Commit Graph

840 Commits

Author SHA1 Message Date
Jeremiah Senkpiel a222b1d130 fix: avoid panic when translating from hyperium
Before it always paniced on new headers while trying to blankly unwrap
the return of a hashmap insert.

This makes it:
  a. no longer unwrap at all, which was incorrect, and
  b. use append for duplicates

The opposite direction also uses hyperium's append, but (I think) this
was written before that same functionality existed in http-types.
2021-04-27 10:25:43 -07:00
Jeremiah Senkpiel a460c7a724
Merge pull request #358 from red15/fastrand_replacement
using fastrand instead of rand crate
2021-04-21 10:02:07 -07:00
Niels Huylebroeck 6bcd2a458e using fastrand instead of rand crate
refer to http-rs/http-types#357 for reasoning, just implementing here to
allow testing and validating the implementation.
2021-04-15 18:30:23 +02:00
Jeremiah Senkpiel 85409417e5
Merge pull request #354 from Tpt/error
Fixes error messages in Content-Type and Transfer-Encoding negotiation
2021-04-12 11:05:37 -07:00
Tpt 8aaef9ad6a Fixes error messages in Content-Type and Transfer-Encoding negotiation 2021-04-09 06:43:51 +02:00
Jeremiah Senkpiel dab0f62e6d
Merge pull request #345 from Fishrock123/Error-from_lossy
feat: add Error::from_display & from_debug
2021-04-07 11:19:22 -07:00
Jeremiah Senkpiel 196244fa83 feat: add Error::from_display & from_debug
This is handy for errors (or other structs) which are not `Send + Sync + 'static`.
2021-04-07 11:01:42 -07:00
Jeremiah Senkpiel a906badc1b
Merge pull request #333 from Fishrock123/request-query-deserialize-borrowed
Request: allow Deserialize<'de> for .query()
2021-04-02 12:02:15 -07:00
Jeremiah Senkpiel 96030f7f02
Merge pull request #351 from Fishrock123/version-as_ref-str
feat: add AsRef<str> for Version
2021-04-02 12:01:36 -07:00
Jeremiah Senkpiel b9d6026647 feat: add AsRef<str> for Version
Allows getting a static string slice of the version, rather than a `String`.
2021-04-01 15:51:33 -07:00
Jeremiah Senkpiel b3a9b96159
Merge pull request #348 from Fishrock123/ci-improvements
ci: another round of improvements
2021-03-06 11:59:17 -08:00
Jeremiah Senkpiel 4845f1f7cd fix: address new clippy::needless_question_mark
from nightly
2021-03-06 19:22:57 -08:00
Jeremiah Senkpiel 656133fc27 ci: re-enable wasm check
But without default features, because the 'getrandom' dep from cookie
has decided it won't build on wasm. Fun!
2021-03-06 19:21:39 -08:00
Jeremiah Senkpiel c4e83230a6 ci: relax errors on warnings
missing_doc_code_examples was renamed to rustdoc::missing_doc_code_examples on nightly but the rustdoc lint tool namespace doesn't exist on stable.
2021-03-06 19:16:56 -08:00
Jeremiah Senkpiel d6846520c6 ci: use nightly again for check_fmt_clippy_docs
actions-rs now does the appropriate component fallback for this.
2021-03-06 19:16:56 -08:00
Jeremiah Senkpiel cdc86a66cf ci: use --all-targets for 'check' invocations 2021-03-06 19:08:17 -08:00
Josh Triplett 6e0cd018d7
Merge pull request #346 from joshtriplett/chain-better
Make Body::chain not depend on the async-std feature
2021-03-04 16:38:03 -08:00
Josh Triplett 00aa4ad299 Make Body::chain not depend on the async-std feature 2021-03-04 13:23:40 -08:00
Josh Triplett 9a5e0b8e7e
Merge pull request #339 from http-rs/extend-methods
Mark `Method` as non-exhaustive
2021-02-28 13:52:34 -08:00
Josh Triplett 206b53e4b2
Merge pull request #342 from joshtriplett/body-chain
Add Body::chain to create a Body from a series of two Body instances
2021-02-25 14:10:35 -08:00
Yoshua Wuyts 419817db69
Merge pull request #341 from joshtriplett/fix-status-code-docs
Fix status code 4xx documentation to have the right descriptions
2021-02-25 20:29:14 +01:00
Jeremiah Senkpiel f5d310abd5 Request: allow Deserialize<'de> for .query()
Allows us to avoid extra allocations from querystring parsing.
2021-02-25 10:21:40 -08:00
Josh Triplett d93c6fd685 Add a test for Body::chain on Body instances after calling read 2021-02-24 23:38:06 -08:00
Josh Triplett 3760693c00 Add Body::chain to create a Body from a series of two Body instances
This method helps when prepending or appending some data to a Body.
2021-02-24 17:17:20 -08:00
Josh Triplett 1b3bbe0ed7 Fix status code 4xx documentation to have the right descriptions
Several paragraphs of documentation had gotten associated with the wrong
codes.
2021-02-24 14:00:47 -08:00
Yoshua Wuyts e7edb1d671
Merge pull request #340 from http-rs/cleanup-headers
Cleanup headers
2021-02-24 11:00:27 +01:00
Yoshua Wuyts e31ce686e5
Merge pull request #334 from jbr/serde-feature
add a serde feature that's enabled by default
2021-02-23 19:00:05 +01:00
Yoshua Wuyts 570eb8dcb7 cargo fmt 2021-02-23 18:56:42 +01:00
Yoshua Wuyts 19b929f362 Remove unused variables 2021-02-23 18:43:11 +01:00
Yoshua Wuyts 053a20577e Fix broken doc tests 2021-02-23 18:42:47 +01:00
Yoshua Wuyts aed8bfa435 favor insert_header over apply_header
This also implements `Header for T` and provides generic conversions between `Header` and `HeaderName` / `HeaderValue`
2021-02-23 18:34:37 +01:00
Yoshua Wuyts aeb03fde74 checkpoint 2 2021-02-23 18:11:23 +01:00
Yoshua Wuyts 09771fcdf8 checkpoint 1 2021-02-23 17:51:34 +01:00
Yoshua Wuyts 4ed7c9351c remove manual header methods 2021-02-23 17:31:14 +01:00
Yoshua Wuyts f6eb46ce85
Update src/status_code.rs 2021-02-23 17:01:37 +01:00
Yoshua Wuyts caefc9ac00 Mark `Method` as non-exhaustive 2021-02-23 16:46:45 +01:00
Yoshua Wuyts a47a9b1476
Merge pull request #332 from zenekron/all-registered-http-methods
Support all the registered HTTP methods in the `Method` enum
2021-02-23 16:44:49 +01:00
Yoshua Wuyts 2bbadb24a1
Merge pull request #338 from http-rs/fix-clippy-lints
Fix clippy lints
2021-02-23 16:36:07 +01:00
Yoshua Wuyts bd2a7c5f72 Fix clippy lints 2021-02-23 16:21:20 +01:00
Yoshua Wuyts 507f15a451
Merge pull request #315 from http-rs/header-trait
Implement the `Header` trait
2021-02-12 12:52:18 +01:00
Jacob Rothstein 7d6665749e
add a serde feature that's enabled by default 2021-02-11 13:54:11 -08:00
zenekron 4da9660f42 Method: support all registered HTTP Methods 2021-02-06 14:15:22 +01:00
Josh Triplett bf5ace678c
Merge pull request #318 from sunfishcode/main
Rename Body::from_file to Body::from_path, add Body::from_file, handle filename-based MIME-type guessing for File objects
2021-01-23 21:16:24 -08:00
Jeremiah Senkpiel d6f16af29c Body: make len() and related use u64 rather than usize.
Breaking change.

Closes https://github.com/http-rs/http-types/issues/164
2021-01-23 17:19:43 -08:00
Dan Gohman 096c24c096 Rename `from_file` to `from_file_with_path` and add `from_file` with no path. 2021-01-23 17:11:07 -08:00
Dan Gohman 08bb900519 Update tests. 2021-01-23 17:11:07 -08:00
Dan Gohman 176deda147 Rename `from_file` to `from_path` and `from_open_file` to `from_file`. 2021-01-23 17:11:07 -08:00
Dan Gohman 1d06b9b40c Add a `Body::from_open_file` constructor.
This splits a `Body::from_open_file` out from `Body::from_file` so that
users who want to use a file opened in a manner other than `File::open`
can do so.

In particular, this will help users using [`cap_std::fs::Dir::open`] to
open files without requiring http-types to have a dependency on `cap_std`.

[`cap_std::fs::Dir::open`]: https://docs.rs/cap-std/latest/cap_std/fs/struct.Dir.html#method.open

Co-authored-by: brightly-salty <github.downland@aleeas.com>
2021-01-23 17:10:44 -08:00
Josh Triplett 482106b1d3 Merge pull request #305 from brightly-salty/remove-reexports
Remove unneeded re-exports
2021-01-23 15:15:45 -08:00
Josh Triplett b775be8c45
Merge pull request #304 from brightly-salty/fix-formatting
Fix formatting for StatusCode
2021-01-23 15:05:54 -08:00