mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-01 16:55:08 +02:00
use rcgen for tls key generation (#1989)
This commit is contained in:
@ -99,8 +99,10 @@ pub mod test;
|
||||
pub(crate) mod types;
|
||||
pub mod web;
|
||||
|
||||
#[cfg(feature = "cookies")]
|
||||
pub use actix_http::cookie;
|
||||
pub use actix_http::Response as HttpResponse;
|
||||
pub use actix_http::{body, cookie, http, Error, HttpMessage, ResponseError, Result};
|
||||
pub use actix_http::{body, http, Error, HttpMessage, ResponseError, Result};
|
||||
pub use actix_rt as rt;
|
||||
pub use actix_web_codegen::*;
|
||||
|
||||
|
@ -123,18 +123,24 @@ impl<B: MessageBody + Unpin + 'static> MapServiceResponseBody for ServiceRespons
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
// easier to code when cookies feature is disabled
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use super::*;
|
||||
|
||||
use actix_service::IntoService;
|
||||
|
||||
use crate::dev::ServiceRequest;
|
||||
use crate::http::StatusCode;
|
||||
use crate::middleware::{Compress, Condition, Logger};
|
||||
use crate::middleware::{self, Condition, Logger};
|
||||
use crate::test::{call_service, init_service, TestRequest};
|
||||
use crate::{web, App, HttpResponse};
|
||||
|
||||
#[actix_rt::test]
|
||||
#[cfg(feature = "cookies")]
|
||||
async fn test_scope_middleware() {
|
||||
use crate::middleware::Compress;
|
||||
|
||||
let logger = Logger::default();
|
||||
let compress = Compress::default();
|
||||
|
||||
@ -154,7 +160,10 @@ mod tests {
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
#[cfg(feature = "cookies")]
|
||||
async fn test_resource_scope_middleware() {
|
||||
use crate::middleware::Compress;
|
||||
|
||||
let logger = Logger::default();
|
||||
let compress = Compress::default();
|
||||
|
||||
|
@ -429,12 +429,14 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "cookies")]
|
||||
fn test_no_request_cookies() {
|
||||
let req = TestRequest::default().to_http_request();
|
||||
assert!(req.cookies().unwrap().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "cookies")]
|
||||
fn test_request_cookies() {
|
||||
let req = TestRequest::default()
|
||||
.append_header((header::COOKIE, "cookie1=value1"))
|
||||
|
@ -6,10 +6,12 @@ use std::sync::mpsc;
|
||||
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::{Method, StatusCode, Uri, Version};
|
||||
use actix_http::test::TestRequest as HttpTestRequest;
|
||||
use actix_http::{cookie::Cookie, ws, Extensions, HttpService, Request};
|
||||
use actix_http::{ws, Extensions, HttpService, Request};
|
||||
use actix_router::{Path, ResourceDef, Url};
|
||||
use actix_rt::{time::sleep, System};
|
||||
use actix_service::{map_config, IntoService, IntoServiceFactory, Service, ServiceFactory};
|
||||
@ -438,6 +440,7 @@ impl TestRequest {
|
||||
}
|
||||
|
||||
/// Set cookie for this request.
|
||||
#[cfg(feature = "cookies")]
|
||||
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
|
||||
self.req.cookie(cookie);
|
||||
self
|
||||
|
Reference in New Issue
Block a user