1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

Allow to set peer_addr for TestRequest #1074

This commit is contained in:
Nikolay Kim
2019-12-20 16:11:51 +06:00
parent a08d8dab70
commit 20248daeda
3 changed files with 28 additions and 5 deletions

View File

@ -5,7 +5,7 @@ use std::{net, thread, time::Duration};
#[cfg(feature = "openssl")]
use open_ssl::ssl::SslAcceptorBuilder;
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
use actix_web::{web, App, HttpResponse, HttpServer};
fn unused_addr() -> net::SocketAddr {
let addr: net::SocketAddr = "127.0.0.1:0".parse().unwrap();
@ -90,6 +90,8 @@ fn ssl_acceptor() -> std::io::Result<SslAcceptorBuilder> {
#[actix_rt::test]
#[cfg(feature = "openssl")]
async fn test_start_ssl() {
use actix_web::HttpRequest;
let addr = unused_addr();
let (tx, rx) = mpsc::channel();