mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
27 lines
10 KiB
HTML
27 lines
10 KiB
HTML
<!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="Various helpers for Actix applications to use during testing."><title>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 mod"><!--[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><h2 class="location"><a href="#">Module test</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></section><h2><a href="../index.html">In crate actix_web</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>Module <a href="../index.html">actix_web</a>::<wbr><a class="mod" href="#">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_web/test/mod.rs.html#1-88">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>Various helpers for Actix applications to use during testing.</p>
|
|
<h2 id="creating-a-test-service"><a class="doc-anchor" href="#creating-a-test-service">§</a>Creating A Test Service</h2>
|
|
<ul>
|
|
<li><a href="fn.init_service.html" title="fn actix_web::test::init_service"><code>init_service</code></a></li>
|
|
</ul>
|
|
<h2 id="off-the-shelf-test-services"><a class="doc-anchor" href="#off-the-shelf-test-services">§</a>Off-The-Shelf Test Services</h2>
|
|
<ul>
|
|
<li><a href="fn.ok_service.html" title="fn actix_web::test::ok_service"><code>ok_service</code></a></li>
|
|
<li><a href="fn.status_service.html" title="fn actix_web::test::status_service"><code>status_service</code></a></li>
|
|
</ul>
|
|
<h2 id="calling-test-service"><a class="doc-anchor" href="#calling-test-service">§</a>Calling Test Service</h2>
|
|
<ul>
|
|
<li><a href="struct.TestRequest.html" title="struct actix_web::test::TestRequest"><code>TestRequest</code></a></li>
|
|
<li><a href="fn.call_service.html" title="fn actix_web::test::call_service"><code>call_service</code></a></li>
|
|
<li><a href="fn.try_call_service.html" title="fn actix_web::test::try_call_service"><code>try_call_service</code></a></li>
|
|
<li><a href="fn.call_and_read_body.html" title="fn actix_web::test::call_and_read_body"><code>call_and_read_body</code></a></li>
|
|
<li><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></li>
|
|
<li><a href="fn.try_call_and_read_body_json.html" title="fn actix_web::test::try_call_and_read_body_json"><code>try_call_and_read_body_json</code></a></li>
|
|
</ul>
|
|
<h2 id="reading-response-payloads"><a class="doc-anchor" href="#reading-response-payloads">§</a>Reading Response Payloads</h2>
|
|
<ul>
|
|
<li><a href="fn.read_body.html" title="fn actix_web::test::read_body"><code>read_body</code></a></li>
|
|
<li><a href="fn.try_read_body.html" title="fn actix_web::test::try_read_body"><code>try_read_body</code></a></li>
|
|
<li><a href="fn.read_body_json.html" title="fn actix_web::test::read_body_json"><code>read_body_json</code></a></li>
|
|
<li><a href="fn.try_read_body_json.html" title="fn actix_web::test::try_read_body_json"><code>try_read_body_json</code></a></li>
|
|
</ul>
|
|
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.default_service"><code>pub use self::test_services::default_service;</code></div><div class="desc docblock-short"><span class="stab deprecated" title="">Deprecated</span></div></li><li><div class="item-name" id="reexport.simple_service"><code>pub use self::test_services::simple_service;</code></div><div class="desc docblock-short"><span class="stab deprecated" title="">Deprecated</span></div></li><li><div class="item-name" id="reexport.read_response"><code>pub use self::test_utils::read_response;</code></div><div class="desc docblock-short"><span class="stab deprecated" title="">Deprecated</span></div></li><li><div class="item-name" id="reexport.read_response_json"><code>pub use self::test_utils::read_response_json;</code></div><div class="desc docblock-short"><span class="stab deprecated" title="">Deprecated</span></div></li></ul><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.TestBuffer.html" title="struct actix_web::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_web::test::TestRequest">TestRequest</a></div><div class="desc docblock-short">Test <code>Request</code> builder.</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_web::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_web::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_web::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.init_service.html" title="fn actix_web::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_web::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_web::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_web::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.status_service.html" title="fn actix_web::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.try_call_and_read_body_json.html" title="fn actix_web::test::try_call_and_read_body_json">try_call_and_read_body_json</a></div><div class="desc docblock-short">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.</div></li><li><div class="item-name"><a class="fn" href="fn.try_call_service.html" title="fn actix_web::test::try_call_service">try_call_service</a></div><div class="desc docblock-short">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.</div></li><li><div class="item-name"><a class="fn" href="fn.try_read_body.html" title="fn actix_web::test::try_read_body">try_read_body</a></div><div class="desc docblock-short">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.</div></li><li><div class="item-name"><a class="fn" href="fn.try_read_body_json.html" title="fn actix_web::test::try_read_body_json">try_read_body_json</a></div><div class="desc docblock-short">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.</div></li></ul></section></div></main></body></html> |