accept owned strings in TestRequest::param

This commit is contained in:
ibraheemdev 2021-04-19 09:49:49 -04:00
parent 52bb2b5daf
commit b82ff5be01
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
//! Various helpers for Actix applications to use during testing.
use std::{net::SocketAddr, rc::Rc};
use std::{borrow::Cow, net::SocketAddr, rc::Rc};
pub use actix_http::test::TestBuffer;
use actix_http::{
@ -454,7 +454,11 @@ impl TestRequest {
}
/// Set request path pattern parameter
pub fn param(mut self, name: &'static str, value: &'static str) -> Self {
pub fn param(
mut self,
name: impl Into<Cow<'static, str>>,
value: impl Into<Cow<'static, str>>,
) -> Self {
self.path.add_static(name, value);
self
}