1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-30 08:24:28 +02:00

Deploying to gh-pages from @ actix/actix-web@26efa64278 🚀

This commit is contained in:
github-merge-queue[bot]
2024-05-27 01:16:31 +00:00
commit a33fe13cd1
1715 changed files with 215638 additions and 0 deletions

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#143-150">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn call_and_read_body&lt;S, B&gt;(app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;S</a>, req: <a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>) -&gt; <a class="struct" href="../web/struct.Bytes.html" title="struct actix_web::web::Bytes">Bytes</a><div class="where">where
S: <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;<a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = <a class="struct" href="../error/struct.Error.html" title="struct actix_web::error::Error">Error</a>&gt;,
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</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 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">&amp;</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>

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#322-329">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn call_and_read_body_json&lt;S, B, T&gt;(app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;S</a>, req: <a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>) -&gt; T<div class="where">where
S: <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;<a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = <a class="struct" href="../error/struct.Error.html" title="struct actix_web::error::Error">Error</a>&gt;,
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,
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&lt;Person&gt;| <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">&amp;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>

View 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="Calls service and waits for response future completion."><title>call_service in actix_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#93-101">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn call_service&lt;S, R, B, E&gt;(app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;S</a>, req: R) -&gt; S::<a class="associatedtype" href="../dev/trait.Service.html#associatedtype.Response" title="type actix_web::dev::Service::Response">Response</a><div class="where">where
S: <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;R, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = E&gt;,
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">&amp;</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>

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#41-52">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn init_service&lt;R, S, B, E&gt;(
app: R
) -&gt; impl <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;<a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = E&gt;<div class="where">where
R: IntoServiceFactory&lt;S, <a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>&gt;,
S: <a class="trait" href="../dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a>&lt;<a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Config = <a class="struct" href="../dev/struct.AppConfig.html" title="struct actix_web::dev::AppConfig">AppConfig</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = E&gt;,
S::<a class="associatedtype" href="../dev/trait.ServiceFactory.html#associatedtype.InitError" title="type actix_web::dev::ServiceFactory::InitError">InitError</a>: <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>

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_services.rs.html#11-14">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub fn ok_service(
) -&gt; impl <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;<a class="struct" href="../dev/struct.ServiceRequest.html" title="struct actix_web::dev::ServiceRequest">ServiceRequest</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;<a class="struct" href="../body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a>&gt;, Error = <a class="struct" href="../error/struct.Error.html" title="struct actix_web::error::Error">Error</a>&gt;</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>

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#193-201">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn read_body&lt;B&gt;(res: <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;) -&gt; <a class="struct" href="../web/struct.Bytes.html" title="struct actix_web::web::Bytes">Bytes</a><div class="where">where
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</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 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">&amp;</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>

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#255-267">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn read_body_json&lt;T, B&gt;(res: <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;) -&gt; T<div class="where">where
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,
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&lt;Person&gt;| <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">&amp;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>

View 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_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">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"><a class="src" href="../../src/actix_web/test/test_services.rs.html#17-23">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub fn status_service(
status_code: <a class="struct" href="../http/struct.StatusCode.html" title="struct actix_web::http::StatusCode">StatusCode</a>
) -&gt; impl <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;<a class="struct" href="../dev/struct.ServiceRequest.html" title="struct actix_web::dev::ServiceRequest">ServiceRequest</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;<a class="struct" href="../body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a>&gt;, Error = <a class="struct" href="../error/struct.Error.html" title="struct actix_web::error::Error">Error</a>&gt;</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>

View File

@ -0,0 +1,8 @@
<!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="Fallible version of `call_and_read_body_json` that allows testing service call errors."><title>try_call_and_read_body_json in actix_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">test</a>::<wbr><a class="fn" href="#">try_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"><a class="src" href="../../src/actix_web/test/test_utils.rs.html#332-345">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn try_call_and_read_body_json&lt;S, B, T&gt;(
app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;S</a>,
req: <a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/error/trait.Error.html" title="trait core::error::Error">StdError</a>&gt;&gt;<div class="where">where
S: <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;<a class="struct" href="../../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = <a class="struct" href="../error/struct.Error.html" title="struct actix_web::error::Error">Error</a>&gt;,
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,
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>Fallible version of <a href="fn.call_and_read_body_json.html" title="fn actix_web::test::call_and_read_body_json"><code>call_and_read_body_json</code></a> that allows testing service call errors.</p>
</div></details></section></div></main></body></html>

View File

@ -0,0 +1,7 @@
<!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="Fallible version of `call_service` that allows testing response completion errors."><title>try_call_service in actix_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">test</a>::<wbr><a class="fn" href="#">try_call_service</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_web/test/test_utils.rs.html#104-110">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn try_call_service&lt;S, R, B, E&gt;(
app: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;S</a>,
req: R
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;S::<a class="associatedtype" href="../dev/trait.Service.html#associatedtype.Response" title="type actix_web::dev::Service::Response">Response</a>, E&gt;<div class="where">where
S: <a class="trait" href="../dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a>&lt;R, Response = <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;, Error = E&gt;,
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>Fallible version of <a href="fn.call_service.html" title="fn actix_web::test::call_service"><code>call_service</code></a> that allows testing response completion errors.</p>
</div></details></section></div></main></body></html>

View File

@ -0,0 +1,5 @@
<!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="Fallible version of `read_body` that allows testing MessageBody reading errors."><title>try_read_body in actix_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">test</a>::<wbr><a class="fn" href="#">try_read_body</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_web/test/test_utils.rs.html#204-210">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn try_read_body&lt;B&gt;(
res: <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../web/struct.Bytes.html" title="struct actix_web::web::Bytes">Bytes</a>, &lt;B as <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>&gt;::<a class="associatedtype" href="../body/trait.MessageBody.html#associatedtype.Error" title="type actix_web::body::MessageBody::Error">Error</a>&gt;<div class="where">where
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Fallible version of <a href="fn.read_body.html" title="fn actix_web::test::read_body"><code>read_body</code></a> that allows testing MessageBody reading errors.</p>
</div></details></section></div></main></body></html>

View File

@ -0,0 +1,6 @@
<!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="Fallible version of `read_body_json` that allows testing response deserialization errors."><title>try_read_body_json in actix_web::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_web" 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_web/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_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In actix_web::test</a></h2></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_web</a>::<wbr><a href="index.html">test</a>::<wbr><a class="fn" href="#">try_read_body_json</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_web/test/test_utils.rs.html#270-279">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub async fn try_read_body_json&lt;T, B&gt;(
res: <a class="struct" href="../dev/struct.ServiceResponse.html" title="struct actix_web::dev::ServiceResponse">ServiceResponse</a>&lt;B&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/error/trait.Error.html" title="trait core::error::Error">StdError</a>&gt;&gt;<div class="where">where
B: <a class="trait" href="../body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,
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>Fallible version of <a href="fn.read_body_json.html" title="fn actix_web::test::read_body_json"><code>read_body_json</code></a> that allows testing response deserialization errors.</p>
</div></details></section></div></main></body></html>

27
actix_web/test/index.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["call_and_read_body","call_and_read_body_json","call_service","init_service","ok_service","read_body","read_body_json","status_service","try_call_and_read_body_json","try_call_service","try_read_body","try_read_body_json"],"struct":["TestBuffer","TestRequest"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/struct.TestRequest.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/struct.TestRequest.html">../../../actix_web/test/struct.TestRequest.html</a>...</p>
<script>location.replace("../../../actix_web/test/struct.TestRequest.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.ok_service.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.ok_service.html">../../../actix_web/test/fn.ok_service.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.ok_service.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.status_service.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.status_service.html">../../../actix_web/test/fn.status_service.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.status_service.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.call_and_read_body.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.call_and_read_body.html">../../../actix_web/test/fn.call_and_read_body.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.call_and_read_body.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.call_and_read_body_json.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.call_and_read_body_json.html">../../../actix_web/test/fn.call_and_read_body_json.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.call_and_read_body_json.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.call_service.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.call_service.html">../../../actix_web/test/fn.call_service.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.call_service.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.init_service.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.init_service.html">../../../actix_web/test/fn.init_service.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.init_service.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.read_body.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.read_body.html">../../../actix_web/test/fn.read_body.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.read_body.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.read_body_json.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.read_body_json.html">../../../actix_web/test/fn.read_body_json.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.read_body_json.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.try_call_and_read_body_json.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.try_call_and_read_body_json.html">../../../actix_web/test/fn.try_call_and_read_body_json.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.try_call_and_read_body_json.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.try_call_service.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.try_call_service.html">../../../actix_web/test/fn.try_call_service.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.try_call_service.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.try_read_body.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.try_read_body.html">../../../actix_web/test/fn.try_read_body.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.try_read_body.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../actix_web/test/fn.try_read_body_json.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../actix_web/test/fn.try_read_body_json.html">../../../actix_web/test/fn.try_read_body_json.html</a>...</p>
<script>location.replace("../../../actix_web/test/fn.try_read_body_json.html" + location.search + location.hash);</script>
</body>
</html>