Skip to content

Commit

Permalink
Rename feature http -> http-crate
Browse files Browse the repository at this point in the history
In the context of ureq "http" is a bit too generic feature name to use
for the http crate interop. Instead we use "http-crate" for the 1.0
dependency.
  • Loading branch information
algesten committed Nov 24, 2023
1 parent 87108e0 commit 7369043
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ jobs:
- native-certs
- gzip
- brotli
- http
- http-crate
- http-interop
- http http-interop
- http-crate http-interop
env:
RUST_BACKTRACE: "1"
RUSTFLAGS: "-D dead_code -D unused-variables -D unused"
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 2.9.1

## Fixed

* Unbreak feature `http-interop`. This feature is version locked to http crate 0.2
* New feature `http-crate`. This feature is for http crate 1.0
* New feature `proxy-from-env` to detect proxy settings for global Agent (ureq::get).

# 2.9.0

## Fixed
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ cookies = ["dep:cookie", "dep:cookie_store"]
socks-proxy = ["dep:socks"]
gzip = ["dep:flate2"]
brotli = ["dep:brotli-decompressor"]
# http-interop is for http crate version 0.2 (backwards compat with last pre-release)
# Consider this feature deprecated. In time, we will remove it. Use `http-crate` instead.
http-interop = ["dep:http-02"]
http = ["dep:http"]
# http-crate is for http crate version 1.0 (full release)
http-crate = ["dep:http"]
proxy-from-env = []

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn get_header<'h>(headers: &'h [Header], name: &str) -> Option<&'h str> {
.and_then(|h| h.value())
}

#[cfg(any(doc, all(test, any(feature = "http-interop", feature = "http"))))]
#[cfg(any(doc, all(test, any(feature = "http-interop", feature = "http-crate"))))]
pub fn get_header_raw<'h>(headers: &'h [Header], name: &str) -> Option<&'h [u8]> {
headers
.iter()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/http_interop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ impl From<Request> for http::request::Builder {

#[cfg(test)]
mod tests {
use http_02 as http;
use crate::header::{add_header, get_header_raw, HeaderLine};
use http_02 as http;

#[test]
fn convert_http_response() {
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,12 @@ mod test;
mod testserver;

#[cfg(feature = "http-interop")]
// 0.2 version dependency (deprecated)
mod http_interop;

#[cfg(feature = "http")]
mod http;
#[cfg(feature = "http-crate")]
// 1.0 version dependency.
mod http_crate;

pub use crate::agent::Agent;
pub use crate::agent::AgentBuilder;
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eu
export RUST_BACKTRACE=1
export RUSTFLAGS="-D dead_code -D unused-variables -D unused"

for feature in "" tls json charset cookies socks-proxy "tls native-certs" native-tls gzip brotli http-interop; do
for feature in "" tls json charset cookies socks-proxy "tls native-certs" native-tls gzip brotli http-interop http-crate; do
if ! cargo test --no-default-features --features "${feature}" ; then
echo Command failed: cargo test --no-default-features --features \"${feature}\"
exit 1
Expand Down

0 comments on commit 7369043

Please sign in to comment.