mirror of https://github.com/fafhrd91/actix-web
Compare commits
7 Commits
22508fcdac
...
94f460be97
Author | SHA1 | Date |
---|---|---|
|
94f460be97 | |
|
8996198f2c | |
|
68624ec63b | |
|
bcd0ffb016 | |
|
845534fc81 | |
|
605bcd18c6 | |
|
612e983576 |
|
@ -17,7 +17,6 @@ edition.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"http2",
|
||||
"ws",
|
||||
|
@ -119,7 +118,7 @@ tokio-util = { version = "0.7", features = ["io", "codec"] }
|
|||
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
||||
|
||||
# http2
|
||||
h2 = { version = "0.3.26", optional = true }
|
||||
h2 = { version = "0.3.27", optional = true }
|
||||
|
||||
# websockets
|
||||
base64 = { version = "0.22", optional = true }
|
||||
|
|
|
@ -139,7 +139,7 @@ async fn h1_expect() {
|
|||
|
||||
// test expect would fail to continue
|
||||
let request = srv
|
||||
.request(http::Method::GET, srv.url("/"))
|
||||
.request(http::Method::POST, srv.url("/"))
|
||||
.insert_header(("Expect", "100-continue"));
|
||||
|
||||
let response = request.send_body("expect body").await.unwrap();
|
||||
|
@ -147,7 +147,7 @@ async fn h1_expect() {
|
|||
|
||||
// test expect would continue
|
||||
let request = srv
|
||||
.request(http::Method::GET, srv.url("/"))
|
||||
.request(http::Method::POST, srv.url("/"))
|
||||
.insert_header(("Expect", "100-continue"))
|
||||
.insert_header(("AUTH", "996"));
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ async fn h2_body() -> io::Result<()> {
|
|||
})
|
||||
.await;
|
||||
|
||||
let response = srv.sget("/").send_body(data.clone()).await.unwrap();
|
||||
let response = srv.spost("/").send_body(data.clone()).await.unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
||||
let body = srv.load_body(response).await.unwrap();
|
||||
|
|
|
@ -184,7 +184,7 @@ async fn h2_body1() -> io::Result<()> {
|
|||
})
|
||||
.await;
|
||||
|
||||
let response = srv.sget("/").send_body(data.clone()).await.unwrap();
|
||||
let response = srv.spost("/").send_body(data.clone()).await.unwrap();
|
||||
assert!(response.status().is_success());
|
||||
|
||||
let body = srv.load_body(response).await.unwrap();
|
||||
|
|
|
@ -11,7 +11,6 @@ edition.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
all-features = true
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -14,7 +14,6 @@ license.workspace = true
|
|||
edition.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
all-features = true
|
||||
|
||||
[package.metadata.cargo_check_external_types]
|
||||
|
|
|
@ -17,7 +17,6 @@ edition.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"macros",
|
||||
"openssl",
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
- `GET/HEAD/OPTIONS/TRACE` methods no longer send a request body on request.
|
||||
|
||||
## 3.7.0
|
||||
|
||||
- Update `brotli` dependency to `8`.
|
||||
|
|
|
@ -16,7 +16,6 @@ license = "MIT OR Apache-2.0"
|
|||
edition = "2021"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"cookies",
|
||||
"openssl",
|
||||
|
@ -109,7 +108,7 @@ cfg-if = "1"
|
|||
derive_more = { version = "2", features = ["display", "error", "from"] }
|
||||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc", "sink"] }
|
||||
h2 = "0.3.26"
|
||||
h2 = "0.3.27"
|
||||
http = "0.2.7"
|
||||
itoa = "1"
|
||||
log = "0.4"
|
||||
|
|
|
@ -4,8 +4,12 @@ use std::{
|
|||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
use actix_http::body::{BodySize, BoxBody, MessageBody};
|
||||
use actix_http::{
|
||||
body::{BodySize, BoxBody, MessageBody},
|
||||
RequestHead,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
@ -75,11 +79,15 @@ where
|
|||
/// Converts a [`MessageBody`] type into the best possible representation.
|
||||
///
|
||||
/// Checks size for `None` and tries to convert to `Bytes`. Otherwise, uses the `Body` variant.
|
||||
pub fn from_message_body(body: B) -> Self
|
||||
pub fn from_message_body(head: &RequestHead, body: B) -> Self
|
||||
where
|
||||
B: MessageBody,
|
||||
{
|
||||
if matches!(body.size(), BodySize::None) {
|
||||
if matches!(
|
||||
head.method,
|
||||
Method::GET | Method::HEAD | Method::OPTIONS | Method::TRACE
|
||||
) || matches!(body.size(), BodySize::None)
|
||||
{
|
||||
return Self::None;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,16 +189,14 @@ impl RequestSender {
|
|||
body: impl MessageBody + 'static,
|
||||
) -> SendClientRequest {
|
||||
let req = match self {
|
||||
RequestSender::Owned(head) => ConnectRequest::Client(
|
||||
RequestHeadType::Owned(head),
|
||||
AnyBody::from_message_body(body).into_boxed(),
|
||||
addr,
|
||||
),
|
||||
RequestSender::Rc(head, extra_headers) => ConnectRequest::Client(
|
||||
RequestHeadType::Rc(head, extra_headers),
|
||||
AnyBody::from_message_body(body).into_boxed(),
|
||||
addr,
|
||||
),
|
||||
RequestSender::Owned(head) => {
|
||||
let body = AnyBody::from_message_body(&head, body).into_boxed();
|
||||
ConnectRequest::Client(RequestHeadType::Owned(head), body, addr)
|
||||
}
|
||||
RequestSender::Rc(head, extra_headers) => {
|
||||
let body = AnyBody::from_message_body(&head, body).into_boxed();
|
||||
ConnectRequest::Client(RequestHeadType::Rc(head, extra_headers), body, addr)
|
||||
}
|
||||
};
|
||||
|
||||
let fut = config.connector.call(req);
|
||||
|
|
|
@ -62,7 +62,7 @@ async fn json() {
|
|||
});
|
||||
|
||||
let request = srv
|
||||
.get("/")
|
||||
.post("/")
|
||||
.insert_header(("x-test", "111"))
|
||||
.send_json(&"TEST".to_string());
|
||||
let response = request.await.unwrap();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# developed on macOS and probably doesn't work on Linux yet due to minor
|
||||
# differences in flags on sed
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# run tests matching what CI does for non-linux feature sets
|
||||
|
||||
set -x
|
||||
|
||||
EXIT=0
|
||||
|
||||
save_exit_code() {
|
||||
eval $@
|
||||
local CMD_EXIT=$?
|
||||
[ "$CMD_EXIT" = "0" ] || EXIT=$CMD_EXIT
|
||||
}
|
||||
|
||||
save_exit_code cargo test --lib --tests -p=actix-router --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-http --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-web --features=rustls,openssl -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-web-codegen --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=awc --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-http-test --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-test --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-files -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-multipart --all-features -- --nocapture
|
||||
save_exit_code cargo test --lib --tests -p=actix-web-actors --all-features -- --nocapture
|
||||
|
||||
save_exit_code cargo test --workspace --doc
|
||||
|
||||
if [ "$EXIT" = "0" ]; then
|
||||
PASSED="All tests passed!"
|
||||
|
||||
if [ "$(command -v figlet)" ]; then
|
||||
figlet "$PASSED"
|
||||
else
|
||||
echo "$PASSED"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $EXIT
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -Euo pipefail
|
||||
|
||||
for dir in $@; do
|
||||
cd "$dir"
|
||||
|
||||
cargo publish --dry-run
|
||||
|
||||
read -p "Look okay? "
|
||||
read -p "Sure? "
|
||||
|
||||
cargo publish
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
read -p "Was the above error caused by cyclic dev-deps? Choosing yes will publish without a git backreference. (y/N) " publish_no_dev_deps
|
||||
|
||||
if [[ "$publish_no_dev_deps" == "y" || "$publish_no_dev_deps" == "Y" ]]; then
|
||||
cargo hack --no-dev-deps publish --allow-dirty
|
||||
fi
|
||||
fi
|
||||
|
||||
cd ..
|
||||
done
|
Loading…
Reference in New Issue