mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-30 00:14:58 +02:00
Deploying to gh-pages from @ actix/actix-web@26efa64278 🚀
This commit is contained in:
1
actix_test/all.html
Normal file
1
actix_test/all.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.Client.html">Client</a></li><li><a href="struct.ClientRequest.html">ClientRequest</a></li><li><a href="struct.ClientResponse.html">ClientResponse</a></li><li><a href="struct.Connector.html">Connector</a></li><li><a href="struct.TestBuffer.html">TestBuffer</a></li><li><a href="struct.TestRequest.html">TestRequest</a></li><li><a href="struct.TestServer.html">TestServer</a></li><li><a href="struct.TestServerConfig.html">TestServerConfig</a></li></ul><h3 id="enums">Enums</h3><ul class="all-items"><li><a href="enum.PayloadError.html">PayloadError</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.call_and_read_body.html">call_and_read_body</a></li><li><a href="fn.call_and_read_body_json.html">call_and_read_body_json</a></li><li><a href="fn.call_service.html">call_service</a></li><li><a href="fn.config.html">config</a></li><li><a href="fn.init_service.html">init_service</a></li><li><a href="fn.ok_service.html">ok_service</a></li><li><a href="fn.read_body.html">read_body</a></li><li><a href="fn.read_body_json.html">read_body_json</a></li><li><a href="fn.start.html">start</a></li><li><a href="fn.start_with.html">start_with</a></li><li><a href="fn.status_service.html">status_service</a></li><li><a href="fn.to_bytes.html">to_bytes</a></li><li><a href="fn.unused_addr.html">unused_addr</a></li></ul></section></div></main></body></html>
|
35
actix_test/enum.PayloadError.html
Normal file
35
actix_test/enum.PayloadError.html
Normal file
File diff suppressed because one or more lines are too long
32
actix_test/fn.call_and_read_body.html
Normal file
32
actix_test/fn.call_and_read_body.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Helper function that returns a response body of a TestRequest"><title>call_and_read_body in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">call_and_read_body</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn call_and_read_body<S, B>(app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&S</a>, req: Request) -> Bytes<div class="where">where
|
||||
S: Service<Request, Response = ServiceResponse<B>, Error = Error>,
|
||||
B: MessageBody,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper function that returns a response body of a TestRequest</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{test, web, App, HttpResponse, http::header};
|
||||
<span class="kw">use </span>bytes::Bytes;
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_index() {
|
||||
<span class="kw">let </span>app = test::init_service(
|
||||
App::new().service(
|
||||
web::resource(<span class="string">"/index.html"</span>)
|
||||
.route(web::post().to(|| <span class="kw">async </span>{
|
||||
HttpResponse::Ok().body(<span class="string">"welcome!"</span>)
|
||||
})))
|
||||
).<span class="kw">await</span>;
|
||||
|
||||
<span class="kw">let </span>req = test::TestRequest::post()
|
||||
.uri(<span class="string">"/index.html"</span>)
|
||||
.header(header::CONTENT_TYPE, <span class="string">"application/json"</span>)
|
||||
.to_request();
|
||||
|
||||
<span class="kw">let </span>result = test::call_and_read_body(<span class="kw-2">&</span>app, req).<span class="kw">await</span>;
|
||||
<span class="macro">assert_eq!</span>(result, Bytes::from_static(<span class="string">b"welcome!"</span>));
|
||||
}</code></pre></div>
|
||||
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||
<p>Panics if:</p>
|
||||
<ul>
|
||||
<li>service call returns error;</li>
|
||||
<li>body yields an error while it is being read.</li>
|
||||
</ul>
|
||||
</div></details></section></div></main></body></html>
|
43
actix_test/fn.call_and_read_body_json.html
Normal file
43
actix_test/fn.call_and_read_body_json.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Helper function that returns a deserialized response body of a TestRequest"><title>call_and_read_body_json in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">call_and_read_body_json</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn call_and_read_body_json<S, B, T>(app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&S</a>, req: Request) -> T<div class="where">where
|
||||
S: Service<Request, Response = ServiceResponse<B>, Error = Error>,
|
||||
B: MessageBody,
|
||||
T: <a class="trait" href="https://docs.rs/serde/1.0.203/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper function that returns a deserialized response body of a TestRequest</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{App, test, web, HttpResponse, http::header};
|
||||
<span class="kw">use </span>serde::{Serialize, Deserialize};
|
||||
|
||||
<span class="attr">#[derive(Serialize, Deserialize)]
|
||||
</span><span class="kw">pub struct </span>Person {
|
||||
id: String,
|
||||
name: String
|
||||
}
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_add_person() {
|
||||
<span class="kw">let </span>app = test::init_service(
|
||||
App::new().service(
|
||||
web::resource(<span class="string">"/people"</span>)
|
||||
.route(web::post().to(|person: web::Json<Person>| <span class="kw">async </span>{
|
||||
HttpResponse::Ok()
|
||||
.json(person)})
|
||||
))
|
||||
).<span class="kw">await</span>;
|
||||
|
||||
<span class="kw">let </span>payload = <span class="string">r#"{"id":"12345","name":"User name"}"#</span>.as_bytes();
|
||||
|
||||
<span class="kw">let </span>req = test::TestRequest::post()
|
||||
.uri(<span class="string">"/people"</span>)
|
||||
.header(header::CONTENT_TYPE, <span class="string">"application/json"</span>)
|
||||
.set_payload(payload)
|
||||
.to_request();
|
||||
|
||||
<span class="kw">let </span>result: Person = test::call_and_read_body_json(<span class="kw-2">&mut </span>app, req).<span class="kw">await</span>;
|
||||
}</code></pre></div>
|
||||
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||
<p>Panics if:</p>
|
||||
<ul>
|
||||
<li>service call returns an error body yields an error while it is being read;</li>
|
||||
<li>body yields an error while it is being read;</li>
|
||||
<li>received body is not a valid JSON representation of <code>T</code>.</li>
|
||||
</ul>
|
||||
</div></details></section></div></main></body></html>
|
28
actix_test/fn.call_service.html
Normal file
28
actix_test/fn.call_service.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Calls service and waits for response future completion."><title>call_service in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">call_service</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn call_service<S, R, B, E>(
|
||||
app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&S</a>,
|
||||
req: R
|
||||
) -> <S as Service<R>>::Response<div class="where">where
|
||||
S: Service<R, Response = ServiceResponse<B>, Error = E>,
|
||||
E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Calls service and waits for response future completion.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{test, web, App, HttpResponse, http::StatusCode};
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_response() {
|
||||
<span class="kw">let </span>app = test::init_service(
|
||||
App::new()
|
||||
.service(web::resource(<span class="string">"/test"</span>).to(|| <span class="kw">async </span>{
|
||||
HttpResponse::Ok()
|
||||
}))
|
||||
).<span class="kw">await</span>;
|
||||
|
||||
<span class="comment">// Create request object
|
||||
</span><span class="kw">let </span>req = test::TestRequest::with_uri(<span class="string">"/test"</span>).to_request();
|
||||
|
||||
<span class="comment">// Call application
|
||||
</span><span class="kw">let </span>res = test::call_service(<span class="kw-2">&</span>app, req).<span class="kw">await</span>;
|
||||
<span class="macro">assert_eq!</span>(res.status(), StatusCode::OK);
|
||||
}</code></pre></div>
|
||||
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||
<p>Panics if service call returns error. To handle errors use <code>app.call(req)</code>.</p>
|
||||
</div></details></section></div></main></body></html>
|
2
actix_test/fn.config.html
Normal file
2
actix_test/fn.config.html
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Create default test server config."><title>config in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">config</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/actix_test/lib.rs.html#499-501">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn config() -> <a class="struct" href="struct.TestServerConfig.html" title="struct actix_test::TestServerConfig">TestServerConfig</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Create default test server config.</p>
|
||||
</div></details></section></div></main></body></html>
|
27
actix_test/fn.init_service.html
Normal file
27
actix_test/fn.init_service.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Initialize service from application builder instance."><title>init_service in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">init_service</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn init_service<R, S, B, E>(
|
||||
app: R
|
||||
) -> impl Service<Request, Response = ServiceResponse<B>, Error = E><div class="where">where
|
||||
R: IntoServiceFactory<S, Request>,
|
||||
S: ServiceFactory<Request, Config = AppConfig, Response = ServiceResponse<B>, Error = E>,
|
||||
<S as ServiceFactory<Request>>::InitError: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Initialize service from application builder instance.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_service::Service;
|
||||
<span class="kw">use </span>actix_web::{test, web, App, HttpResponse, http::StatusCode};
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_init_service() {
|
||||
<span class="kw">let </span>app = test::init_service(
|
||||
App::new()
|
||||
.service(web::resource(<span class="string">"/test"</span>).to(|| <span class="kw">async </span>{ <span class="string">"OK" </span>}))
|
||||
).<span class="kw">await</span>;
|
||||
|
||||
<span class="comment">// Create request object
|
||||
</span><span class="kw">let </span>req = test::TestRequest::with_uri(<span class="string">"/test"</span>).to_request();
|
||||
|
||||
<span class="comment">// Execute application
|
||||
</span><span class="kw">let </span>res = app.call(req).<span class="kw">await</span>.unwrap();
|
||||
<span class="macro">assert_eq!</span>(res.status(), StatusCode::OK);
|
||||
}</code></pre></div>
|
||||
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||
<p>Panics if service initialization returns an error.</p>
|
||||
</div></details></section></div></main></body></html>
|
3
actix_test/fn.ok_service.html
Normal file
3
actix_test/fn.ok_service.html
Normal file
@ -0,0 +1,3 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Creates service that always responds with `200 OK` and no body."><title>ok_service in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">ok_service</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn ok_service(
|
||||
) -> impl Service<ServiceRequest, Response = ServiceResponse, Error = Error></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates service that always responds with <code>200 OK</code> and no body.</p>
|
||||
</div></details></section></div></main></body></html>
|
28
actix_test/fn.read_body.html
Normal file
28
actix_test/fn.read_body.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Helper function that returns a response body of a ServiceResponse."><title>read_body in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">read_body</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn read_body<B>(res: ServiceResponse<B>) -> Bytes<div class="where">where
|
||||
B: MessageBody,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper function that returns a response body of a ServiceResponse.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{test, web, App, HttpResponse, http::header};
|
||||
<span class="kw">use </span>bytes::Bytes;
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_index() {
|
||||
<span class="kw">let </span>app = test::init_service(
|
||||
App::new().service(
|
||||
web::resource(<span class="string">"/index.html"</span>)
|
||||
.route(web::post().to(|| <span class="kw">async </span>{
|
||||
HttpResponse::Ok().body(<span class="string">"welcome!"</span>)
|
||||
})))
|
||||
).<span class="kw">await</span>;
|
||||
|
||||
<span class="kw">let </span>req = test::TestRequest::post()
|
||||
.uri(<span class="string">"/index.html"</span>)
|
||||
.header(header::CONTENT_TYPE, <span class="string">"application/json"</span>)
|
||||
.to_request();
|
||||
|
||||
<span class="kw">let </span>res = test::call_service(<span class="kw-2">&</span>app, req).<span class="kw">await</span>;
|
||||
<span class="kw">let </span>result = test::read_body(res).<span class="kw">await</span>;
|
||||
<span class="macro">assert_eq!</span>(result, Bytes::from_static(<span class="string">b"welcome!"</span>));
|
||||
}</code></pre></div>
|
||||
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||
<p>Panics if body yields an error while it is being read.</p>
|
||||
</div></details></section></div></main></body></html>
|
44
actix_test/fn.read_body_json.html
Normal file
44
actix_test/fn.read_body_json.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Helper function that returns a deserialized response body of a ServiceResponse."><title>read_body_json in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">read_body_json</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn read_body_json<T, B>(res: ServiceResponse<B>) -> T<div class="where">where
|
||||
B: MessageBody,
|
||||
T: <a class="trait" href="https://docs.rs/serde/1.0.203/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper function that returns a deserialized response body of a ServiceResponse.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{App, test, web, HttpResponse, http::header};
|
||||
<span class="kw">use </span>serde::{Serialize, Deserialize};
|
||||
|
||||
<span class="attr">#[derive(Serialize, Deserialize)]
|
||||
</span><span class="kw">pub struct </span>Person {
|
||||
id: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_post_person() {
|
||||
<span class="kw">let </span>app = test::init_service(
|
||||
App::new().service(
|
||||
web::resource(<span class="string">"/people"</span>)
|
||||
.route(web::post().to(|person: web::Json<Person>| <span class="kw">async </span>{
|
||||
HttpResponse::Ok()
|
||||
.json(person)})
|
||||
))
|
||||
).<span class="kw">await</span>;
|
||||
|
||||
<span class="kw">let </span>payload = <span class="string">r#"{"id":"12345","name":"User name"}"#</span>.as_bytes();
|
||||
|
||||
<span class="kw">let </span>res = test::TestRequest::post()
|
||||
.uri(<span class="string">"/people"</span>)
|
||||
.header(header::CONTENT_TYPE, <span class="string">"application/json"</span>)
|
||||
.set_payload(payload)
|
||||
.send_request(<span class="kw-2">&mut </span>app)
|
||||
.<span class="kw">await</span>;
|
||||
|
||||
<span class="macro">assert!</span>(res.status().is_success());
|
||||
|
||||
<span class="kw">let </span>result: Person = test::read_body_json(res).<span class="kw">await</span>;
|
||||
}</code></pre></div>
|
||||
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||
<p>Panics if:</p>
|
||||
<ul>
|
||||
<li>body yields an error while it is being read;</li>
|
||||
<li>received body is not a valid JSON representation of <code>T</code>.</li>
|
||||
</ul>
|
||||
</div></details></section></div></main></body></html>
|
29
actix_test/fn.start.html
Normal file
29
actix_test/fn.start.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Start default `TestServer`."><title>start in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">start</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/actix_test/lib.rs.html#82-94">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn start<F, I, S, B>(factory: F) -> <a class="struct" href="struct.TestServer.html" title="struct actix_test::TestServer">TestServer</a><div class="where">where
|
||||
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>() -> I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,
|
||||
I: IntoServiceFactory<S, Request>,
|
||||
S: ServiceFactory<Request, Config = AppConfig> + 'static,
|
||||
S::Error: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Error> + 'static,
|
||||
S::InitError: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
|
||||
S::Response: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Response<B>> + 'static,
|
||||
<S::Service as Service<Request>>::Future: 'static,
|
||||
B: MessageBody + 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Start default <a href="struct.TestServer.html" title="struct actix_test::TestServer"><code>TestServer</code></a>.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{get, web, test, App, HttpResponse, Error, Responder};
|
||||
|
||||
<span class="attr">#[get(<span class="string">"/"</span>)]
|
||||
</span><span class="kw">async fn </span>my_handler() -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>Responder, Error> {
|
||||
<span class="prelude-val">Ok</span>(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_example() {
|
||||
<span class="kw">let </span>srv = actix_test::start(||
|
||||
App::new().service(my_handler)
|
||||
);
|
||||
|
||||
<span class="kw">let </span>req = srv.get(<span class="string">"/"</span>);
|
||||
<span class="kw">let </span>res = req.send().<span class="kw">await</span>.unwrap();
|
||||
|
||||
<span class="macro">assert!</span>(res.status().is_success());
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
30
actix_test/fn.start_with.html
Normal file
30
actix_test/fn.start_with.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Start test server with custom configuration"><title>start_with in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">start_with</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/actix_test/lib.rs.html#121-474">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn start_with<F, I, S, B>(cfg: <a class="struct" href="struct.TestServerConfig.html" title="struct actix_test::TestServerConfig">TestServerConfig</a>, factory: F) -> <a class="struct" href="struct.TestServer.html" title="struct actix_test::TestServer">TestServer</a><div class="where">where
|
||||
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>() -> I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,
|
||||
I: IntoServiceFactory<S, Request>,
|
||||
S: ServiceFactory<Request, Config = AppConfig> + 'static,
|
||||
S::Error: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Error> + 'static,
|
||||
S::InitError: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
|
||||
S::Response: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Response<B>> + 'static,
|
||||
<S::Service as Service<Request>>::Future: 'static,
|
||||
B: MessageBody + 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Start test server with custom configuration</p>
|
||||
<p>Check <a href="struct.TestServerConfig.html" title="struct actix_test::TestServerConfig"><code>TestServerConfig</code></a> docs for configuration options.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{get, web, test, App, HttpResponse, Error, Responder};
|
||||
|
||||
<span class="attr">#[get(<span class="string">"/"</span>)]
|
||||
</span><span class="kw">async fn </span>my_handler() -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>Responder, Error> {
|
||||
<span class="prelude-val">Ok</span>(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_example() {
|
||||
<span class="kw">let </span>srv = actix_test::start_with(actix_test::config().h1(), ||
|
||||
App::new().service(my_handler)
|
||||
);
|
||||
|
||||
<span class="kw">let </span>req = srv.get(<span class="string">"/"</span>);
|
||||
<span class="kw">let </span>res = req.send().<span class="kw">await</span>.unwrap();
|
||||
|
||||
<span class="macro">assert!</span>(res.status().is_success());
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
4
actix_test/fn.status_service.html
Normal file
4
actix_test/fn.status_service.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Creates service that always responds with given status code and no body."><title>status_service in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">status_service</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn status_service(
|
||||
status_code: <a class="struct" href="https://docs.rs/http/0.2.11/http/status/struct.StatusCode.html" title="struct http::status::StatusCode">StatusCode</a>
|
||||
) -> impl Service<ServiceRequest, Response = ServiceResponse, Error = Error></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates service that always responds with given status code and no body.</p>
|
||||
</div></details></section></div></main></body></html>
|
16
actix_test/fn.to_bytes.html
Normal file
16
actix_test/fn.to_bytes.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Collects all the bytes produced by `body`."><title>to_bytes in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">to_bytes</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn to_bytes<B>(body: B) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Bytes, <B as MessageBody>::Error><div class="where">where
|
||||
B: MessageBody,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Collects all the bytes produced by <code>body</code>.</p>
|
||||
<p>Any errors produced by the body stream are returned immediately.</p>
|
||||
<p>Consider using [<code>to_bytes_limited</code>] instead to protect against memory exhaustion.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_http::body::{<span class="self">self</span>, to_bytes};
|
||||
<span class="kw">use </span>bytes::Bytes;
|
||||
|
||||
<span class="kw">let </span>body = body::None::new();
|
||||
<span class="kw">let </span>bytes = to_bytes(body).<span class="kw">await</span>.unwrap();
|
||||
<span class="macro">assert!</span>(bytes.is_empty());
|
||||
|
||||
<span class="kw">let </span>body = Bytes::from_static(<span class="string">b"123"</span>);
|
||||
<span class="kw">let </span>bytes = to_bytes(body).<span class="kw">await</span>.unwrap();
|
||||
<span class="macro">assert_eq!</span>(bytes, <span class="string">"123"</span>);</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
2
actix_test/fn.unused_addr.html
Normal file
2
actix_test/fn.unused_addr.html
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Get a localhost socket address with random, unused port."><title>unused_addr in actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">actix_test</a>::<wbr><a class="fn" href="#">unused_addr</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn unused_addr() -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Get a localhost socket address with random, unused port.</p>
|
||||
</div></details></section></div></main></body></html>
|
25
actix_test/index.html
Normal file
25
actix_test/index.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Integration testing tools for Actix Web applications."><title>actix_test - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_test" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_test/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_test/index.html">actix_test</a><span class="version">0.1.3</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">actix_test</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/actix_test/lib.rs.html#1-749">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Integration testing tools for Actix Web applications.</p>
|
||||
<p>The main integration testing tool is <a href="struct.TestServer.html" title="struct actix_test::TestServer"><code>TestServer</code></a>. It spawns a real HTTP server on an
|
||||
unused port and provides methods that use a real HTTP client. Therefore, it is much closer to
|
||||
real-world cases than using <code>init_service</code>, which skips HTTP encoding and decoding.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{get, web, test, App, HttpResponse, Error, Responder};
|
||||
|
||||
<span class="attr">#[get(<span class="string">"/"</span>)]
|
||||
</span><span class="kw">async fn </span>my_handler() -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>Responder, Error> {
|
||||
<span class="prelude-val">Ok</span>(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
<span class="attr">#[actix_rt::test]
|
||||
</span><span class="kw">async fn </span>test_example() {
|
||||
<span class="kw">let </span>srv = actix_test::start(||
|
||||
App::new().service(my_handler)
|
||||
);
|
||||
|
||||
<span class="kw">let </span>req = srv.get(<span class="string">"/"</span>);
|
||||
<span class="kw">let </span>res = req.send().<span class="kw">await</span>.unwrap();
|
||||
|
||||
<span class="macro">assert!</span>(res.status().is_success());
|
||||
}</code></pre></div>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Client.html" title="struct actix_test::Client">Client</a></div><div class="desc docblock-short">An asynchronous HTTP and WebSocket client.</div></li><li><div class="item-name"><a class="struct" href="struct.ClientRequest.html" title="struct actix_test::ClientRequest">ClientRequest</a></div><div class="desc docblock-short">An HTTP Client request builder</div></li><li><div class="item-name"><a class="struct" href="struct.ClientResponse.html" title="struct actix_test::ClientResponse">ClientResponse</a></div><div class="desc docblock-short">Client Response</div></li><li><div class="item-name"><a class="struct" href="struct.Connector.html" title="struct actix_test::Connector">Connector</a></div><div class="desc docblock-short">Manages HTTP client network connectivity.</div></li><li><div class="item-name"><a class="struct" href="struct.TestBuffer.html" title="struct actix_test::TestBuffer">TestBuffer</a></div><div class="desc docblock-short">Async I/O test buffer.</div></li><li><div class="item-name"><a class="struct" href="struct.TestRequest.html" title="struct actix_test::TestRequest">TestRequest</a></div><div class="desc docblock-short">Test <code>Request</code> builder.</div></li><li><div class="item-name"><a class="struct" href="struct.TestServer.html" title="struct actix_test::TestServer">TestServer</a></div><div class="desc docblock-short">A basic HTTP server controller that simplifies the process of writing integration tests for
|
||||
Actix Web applications.</div></li><li><div class="item-name"><a class="struct" href="struct.TestServerConfig.html" title="struct actix_test::TestServerConfig">TestServerConfig</a></div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.PayloadError.html" title="enum actix_test::PayloadError">PayloadError</a></div><div class="desc docblock-short">A set of errors that can occur during payload parsing.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.call_and_read_body.html" title="fn actix_test::call_and_read_body">call_and_read_body</a></div><div class="desc docblock-short">Helper function that returns a response body of a TestRequest</div></li><li><div class="item-name"><a class="fn" href="fn.call_and_read_body_json.html" title="fn actix_test::call_and_read_body_json">call_and_read_body_json</a></div><div class="desc docblock-short">Helper function that returns a deserialized response body of a TestRequest</div></li><li><div class="item-name"><a class="fn" href="fn.call_service.html" title="fn actix_test::call_service">call_service</a></div><div class="desc docblock-short">Calls service and waits for response future completion.</div></li><li><div class="item-name"><a class="fn" href="fn.config.html" title="fn actix_test::config">config</a></div><div class="desc docblock-short">Create default test server config.</div></li><li><div class="item-name"><a class="fn" href="fn.init_service.html" title="fn actix_test::init_service">init_service</a></div><div class="desc docblock-short">Initialize service from application builder instance.</div></li><li><div class="item-name"><a class="fn" href="fn.ok_service.html" title="fn actix_test::ok_service">ok_service</a></div><div class="desc docblock-short">Creates service that always responds with <code>200 OK</code> and no body.</div></li><li><div class="item-name"><a class="fn" href="fn.read_body.html" title="fn actix_test::read_body">read_body</a></div><div class="desc docblock-short">Helper function that returns a response body of a ServiceResponse.</div></li><li><div class="item-name"><a class="fn" href="fn.read_body_json.html" title="fn actix_test::read_body_json">read_body_json</a></div><div class="desc docblock-short">Helper function that returns a deserialized response body of a ServiceResponse.</div></li><li><div class="item-name"><a class="fn" href="fn.start.html" title="fn actix_test::start">start</a></div><div class="desc docblock-short">Start default <a href="struct.TestServer.html" title="struct actix_test::TestServer"><code>TestServer</code></a>.</div></li><li><div class="item-name"><a class="fn" href="fn.start_with.html" title="fn actix_test::start_with">start_with</a></div><div class="desc docblock-short">Start test server with custom configuration</div></li><li><div class="item-name"><a class="fn" href="fn.status_service.html" title="fn actix_test::status_service">status_service</a></div><div class="desc docblock-short">Creates service that always responds with given status code and no body.</div></li><li><div class="item-name"><a class="fn" href="fn.to_bytes.html" title="fn actix_test::to_bytes">to_bytes</a></div><div class="desc docblock-short">Collects all the bytes produced by <code>body</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.unused_addr.html" title="fn actix_test::unused_addr">unused_addr</a></div><div class="desc docblock-short">Get a localhost socket address with random, unused port.</div></li></ul></section></div></main></body></html>
|
1
actix_test/sidebar-items.js
Normal file
1
actix_test/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
||||
window.SIDEBAR_ITEMS = {"enum":["PayloadError"],"fn":["call_and_read_body","call_and_read_body_json","call_service","config","init_service","ok_service","read_body","read_body_json","start","start_with","status_service","to_bytes","unused_addr"],"struct":["Client","ClientRequest","ClientResponse","Connector","TestBuffer","TestRequest","TestServer","TestServerConfig"]};
|
75
actix_test/struct.Client.html
Normal file
75
actix_test/struct.Client.html
Normal file
File diff suppressed because one or more lines are too long
100
actix_test/struct.ClientRequest.html
Normal file
100
actix_test/struct.ClientRequest.html
Normal file
File diff suppressed because one or more lines are too long
293
actix_test/struct.ClientResponse.html
Normal file
293
actix_test/struct.ClientResponse.html
Normal file
File diff suppressed because one or more lines are too long
90
actix_test/struct.Connector.html
Normal file
90
actix_test/struct.Connector.html
Normal file
File diff suppressed because one or more lines are too long
179
actix_test/struct.TestBuffer.html
Normal file
179
actix_test/struct.TestBuffer.html
Normal file
File diff suppressed because one or more lines are too long
93
actix_test/struct.TestRequest.html
Normal file
93
actix_test/struct.TestRequest.html
Normal file
File diff suppressed because one or more lines are too long
46
actix_test/struct.TestServer.html
Normal file
46
actix_test/struct.TestServer.html
Normal file
File diff suppressed because one or more lines are too long
30
actix_test/struct.TestServerConfig.html
Normal file
30
actix_test/struct.TestServerConfig.html
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user