mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-01 16:55:08 +02:00
added TestServer::client_headers (#2097)
Co-authored-by: fakeshadow <24548779@qq.com> Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
10
src/test.rs
10
src/test.rs
@ -8,7 +8,7 @@ use std::{fmt, net, thread, time};
|
||||
use actix_codec::{AsyncRead, AsyncWrite, Framed};
|
||||
#[cfg(feature = "cookies")]
|
||||
use actix_http::cookie::Cookie;
|
||||
use actix_http::http::header::{ContentType, IntoHeaderPair};
|
||||
use actix_http::http::header::{ContentType, HeaderMap, IntoHeaderPair};
|
||||
use actix_http::http::{Method, StatusCode, Uri, Version};
|
||||
use actix_http::test::TestRequest as HttpTestRequest;
|
||||
use actix_http::{ws, Extensions, HttpService, Request};
|
||||
@ -962,6 +962,14 @@ impl TestServer {
|
||||
self.ws_at("/").await
|
||||
}
|
||||
|
||||
/// Get default HeaderMap of Client.
|
||||
///
|
||||
/// Returns Some(&mut HeaderMap) when Client object is unique
|
||||
/// (No other clone of client exists at the same time).
|
||||
pub fn client_headers(&mut self) -> Option<&mut HeaderMap> {
|
||||
self.client.headers()
|
||||
}
|
||||
|
||||
/// Gracefully stop HTTP server
|
||||
pub async fn stop(self) {
|
||||
self.server.stop(true).await;
|
||||
|
Reference in New Issue
Block a user