This file is indexed.

/usr/share/doc/libghc-hspec-wai-doc/html/Test-Hspec-Wai.html is in libghc-hspec-wai-doc 0.6.6-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Test.Hspec.Wai</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Test-Hspec-Wai.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Test-Hspec-Wai.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hspec-wai-0.6.6: Experimental Hspec support for testing WAI applications</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Test.Hspec.Wai</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Types</a></li><li><a href="#g:2">Performing requests</a><ul><li><a href="#g:3">Posting HTML forms</a></li></ul></li><li><a href="#g:4">Matching on the response</a></li><li><a href="#g:5">Helpers and re-exports</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Have a look at the <a href="https://github.com/hspec/hspec-wai#readme">README</a> for
 an example of how to use this library.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:WaiSession">WaiSession</a> a</li><li class="src short"><span class="keyword">type</span> <a href="#t:WaiExpectation">WaiExpectation</a> = <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> ()</li><li class="src short"><a href="#v:get">get</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:post">post</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:put">put</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:patch">patch</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:options">options</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:delete">delete</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:request">request</a> :: <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#t:Method">Method</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; [<a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:Header">Header</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:postHtmlForm">postHtmlForm</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>)] -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a></li><li class="src short"><a href="#v:shouldRespondWith">shouldRespondWith</a> :: <a href="file:///usr/share/doc/libghc-with-location-doc/html/Data-WithLocation.html#t:WithLocation">WithLocation</a> (<a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a>)</li><li class="src short"><span class="keyword">data</span> <a href="#t:ResponseMatcher">ResponseMatcher</a> = <a href="#v:ResponseMatcher">ResponseMatcher</a> {<ul class="subs"><li><a href="#v:matchStatus">matchStatus</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a></li><li><a href="#v:matchHeaders">matchHeaders</a> :: [<a href="Test-Hspec-Wai.html#t:MatchHeader">MatchHeader</a>]</li><li><a href="#v:matchBody">matchBody</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li></ul>}</li><li class="src short"><span class="keyword">data</span> <a href="#t:MatchHeader">MatchHeader</a> = <a href="#v:MatchHeader">MatchHeader</a> ([<a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:Header">Header</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:-60-:-62-">(&lt;:&gt;)</a> :: <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:HeaderName">HeaderName</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:MatchHeader">MatchHeader</a></li><li class="src short"><a href="#v:liftIO">liftIO</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <span class="keyword">forall</span> a. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> a -&gt; m a</li><li class="src short"><a href="#v:with">with</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> a -&gt; <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:SpecWith">SpecWith</a> a -&gt; <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Spec">Spec</a></li><li class="src short"><a href="#v:pending">pending</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> ()</li><li class="src short"><a href="#v:pendingWith">pendingWith</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> ()</li></ul></div><div id="interface"><h1 id="g:1">Types</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:WaiSession" class="def">WaiSession</a> a <a href="src/Test-Hspec-Wai-Internal.html#WaiSession" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></p><div class="doc"><p>A <a href="http://www.yesodweb.com/book/web-application-interface">WAI</a> test
 session that carries the <code><a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></code> under test an some client state.</p></div><div class="subs instances"><p id="control.i:WaiSession" class="caption collapser" onclick="toggleSection('i:WaiSession')">Instances</p><div id="section.i:WaiSession" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:Monad:1" class="instance expander" onclick="toggleSection('i:id:WaiSession:Monad:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a></span> <a href="src/Test-Hspec-Wai-Internal.html#line-32" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:Monad:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-62--62--61-">(&gt;&gt;=)</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a -&gt; (a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b) -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b <a href="#v:-62--62--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62--62-">(&gt;&gt;)</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b <a href="#v:-62--62-" class="selflink">#</a></p><p class="src"><a href="#v:return">return</a> :: a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a <a href="#v:return" class="selflink">#</a></p><p class="src"><a href="#v:fail">fail</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a <a href="#v:fail" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:Functor:2" class="instance expander" onclick="toggleSection('i:id:WaiSession:Functor:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Functor.html#t:Functor">Functor</a> <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a></span> <a href="src/Test-Hspec-Wai-Internal.html#line-32" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:Functor:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:Applicative:3" class="instance expander" onclick="toggleSection('i:id:WaiSession:Applicative:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Applicative.html#t:Applicative">Applicative</a> <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a></span> <a href="src/Test-Hspec-Wai-Internal.html#line-32" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:Applicative:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:pure">pure</a> :: a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a <a href="#v:pure" class="selflink">#</a></p><p class="src"><a href="#v:-60--42--62-">(&lt;*&gt;)</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> (a -&gt; b) -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b <a href="#v:-60--42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-42--62-">(*&gt;)</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b <a href="#v:-42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-60--42-">(&lt;*)</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> b -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a <a href="#v:-60--42-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:MonadIO:4" class="instance expander" onclick="toggleSection('i:id:WaiSession:MonadIO:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a></span> <a href="src/Test-Hspec-Wai-Internal.html#line-32" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:MonadIO:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:liftIO">liftIO</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> a -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> a <a href="#v:liftIO" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:Example:5" class="instance expander" onclick="toggleSection('i:id:WaiSession:Example:5')"></span> <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Example">Example</a> <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a></span> <a href="src/Test-Hspec-Wai-Internal.html#line-40" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:Example:5" class="inst-details hide"><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Arg">Arg</a> <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a> <a href="#t:Arg" class="selflink">#</a></p></div> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:evaluateExample">evaluateExample</a> :: <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a> -&gt; <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Params">Params</a> -&gt; (<a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:ActionWith">ActionWith</a> (<a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Arg">Arg</a> <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> ()) -&gt; <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:ProgressCallback">ProgressCallback</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Result">Result</a> <a href="#v:evaluateExample" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:Testable:6" class="instance expander" onclick="toggleSection('i:id:WaiSession:Testable:6')"></span> <a href="Test-Hspec-Wai-QuickCheck.html#t:Testable">Testable</a> <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a></span> <a href="src/Test-Hspec-Wai-QuickCheck.html#line-33" class="link">Source</a> <a href="#t:Testable" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:Testable:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toProperty">toProperty</a> :: <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a> -&gt; <a href="Test-Hspec-Wai-QuickCheck.html#t:WaiProperty">WaiProperty</a> <a href="src/Test-Hspec-Wai-QuickCheck.html#toProperty" class="link">Source</a> <a href="#v:toProperty" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:WaiSession:Arg:7" class="instance expander" onclick="toggleSection('i:id:WaiSession:Arg:7')"></span> <span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Arg">Arg</a> <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a></span> <a href="src/Test-Hspec-Wai-Internal.html#line-41" class="link">Source</a> <a href="#t:WaiSession" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:WaiSession:Arg:7" class="inst-details hide"><div class="src"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Arg">Arg</a> <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a> = <a href="file:///usr/share/doc/libghc-wai-doc/html/Network-Wai.html#t:Application">Application</a></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:WaiExpectation" class="def">WaiExpectation</a> = <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> () <a href="src/Test-Hspec-Wai-Internal.html#WaiExpectation" class="link">Source</a> <a href="#t:WaiExpectation" class="selflink">#</a></p><div class="doc"><p>An expectation in the <code><a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a></code> monad.  Failing expectations are
 communicated through exceptions (similar to <code>Expectation</code> and
 <code><a href="Test-HUnit-Base.html#v:Assertion">Assertion</a></code>).</p></div></div><h1 id="g:2">Performing requests</h1><div class="top"><p class="src"><a id="v:get" class="def">get</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#get" class="link">Source</a> <a href="#v:get" class="selflink">#</a></p><div class="doc"><p>Perform a <code>GET</code> request to the application under test.</p></div></div><div class="top"><p class="src"><a id="v:post" class="def">post</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#post" class="link">Source</a> <a href="#v:post" class="selflink">#</a></p><div class="doc"><p>Perform a <code>POST</code> request to the application under test.</p></div></div><div class="top"><p class="src"><a id="v:put" class="def">put</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#put" class="link">Source</a> <a href="#v:put" class="selflink">#</a></p><div class="doc"><p>Perform a <code>PUT</code> request to the application under test.</p></div></div><div class="top"><p class="src"><a id="v:patch" class="def">patch</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#patch" class="link">Source</a> <a href="#v:patch" class="selflink">#</a></p><div class="doc"><p>Perform a <code>PATCH</code> request to the application under test.</p></div></div><div class="top"><p class="src"><a id="v:options" class="def">options</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#options" class="link">Source</a> <a href="#v:options" class="selflink">#</a></p><div class="doc"><p>Perform an <code>OPTIONS</code> request to the application under test.</p></div></div><div class="top"><p class="src"><a id="v:delete" class="def">delete</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#delete" class="link">Source</a> <a href="#v:delete" class="selflink">#</a></p><div class="doc"><p>Perform a <code>DELETE</code> request to the application under test.</p></div></div><div class="top"><p class="src"><a id="v:request" class="def">request</a> :: <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Method.html#t:Method">Method</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; [<a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:Header">Header</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#request" class="link">Source</a> <a href="#v:request" class="selflink">#</a></p><div class="doc"><p>Perform a request to the application under test, with specified HTTP
 method, request path, headers and body.</p></div></div><h2 id="g:3">Posting HTML forms</h2><div class="top"><p class="src"><a id="v:postHtmlForm" class="def">postHtmlForm</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>)] -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> <a href="src/Test-Hspec-Wai.html#postHtmlForm" class="link">Source</a> <a href="#v:postHtmlForm" class="selflink">#</a></p><div class="doc"><p>Perform a <code>POST</code> request to the application under test.</p><p>The specified list of key-value pairs is encoded as
 <code>application/x-www-form-urlencoded</code> and used as request body.</p><p>In additon the <code>Content-Type</code> is set to <code>application/x-www-form-urlencoded</code>.</p></div></div><h1 id="g:4">Matching on the response</h1><div class="top"><p class="src"><a id="v:shouldRespondWith" class="def">shouldRespondWith</a> :: <a href="file:///usr/share/doc/libghc-with-location-doc/html/Data-WithLocation.html#t:WithLocation">WithLocation</a> (<a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> <a href="file:///usr/share/doc/libghc-wai-extra-doc/html/Network-Wai-Test.html#t:SResponse">SResponse</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiExpectation">WaiExpectation</a>) <a href="src/Test-Hspec-Wai.html#shouldRespondWith" class="link">Source</a> <a href="#v:shouldRespondWith" class="selflink">#</a></p><div class="doc"><p>Set the expectation that a response matches a specified <code><a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a></code>.</p><p>A <code>ResponseMatcher</code> matches a response if:</p><ul><li>the specified status matches the HTTP response status code</li><li>the specified body (if any) matches the response body</li><li>the response has all of the specified <code><a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:Header">Header</a></code> fields
   (the response may have arbitrary additional <code><a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:Header">Header</a></code> fields)</li></ul><p>You can use <code>ResponseMatcher</code>'s (broken) <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Num">Num</a></code> instance to match for a HTTP
 status code:</p><pre>get &quot;/&quot; `shouldRespondWith` 200
-- matches if status is 200</pre><p>You can use <code>ResponseMatcher</code>'s <code>IsString</code> instance to match for a HTTP
 status <code>200</code> and a body:</p><pre>get &quot;/&quot; `shouldRespondWith` &quot;foo&quot;
-- matches if body is &quot;foo&quot; and status is 200</pre><p>If you want to match for a different HTTP status, you can use record update
 notation to specify <code><a href="Test-Hspec-Wai.html#v:matchStatus">matchStatus</a></code> explicitly:</p><pre>get &quot;/&quot; `shouldRespondWith` &quot;foo&quot; {matchStatus = 404}
-- matches if body is &quot;foo&quot; and status is 404</pre><p>If you want to require a specific header field you can specify
 <code><a href="Test-Hspec-Wai.html#v:matchHeaders">matchHeaders</a></code>:</p><pre>get &quot;/&quot; `shouldRespondWith` &quot;foo&quot; {matchHeaders = [&quot;Content-Type&quot; &lt;:&gt; &quot;text/plain&quot;]}
-- matches if body is &quot;foo&quot;, status is 200 and ther is a header field &quot;Content-Type: text/plain&quot;</pre></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:ResponseMatcher" class="def">ResponseMatcher</a> <a href="src/Test-Hspec-Wai-Matcher.html#ResponseMatcher" class="link">Source</a> <a href="#t:ResponseMatcher" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:ResponseMatcher" class="def">ResponseMatcher</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:matchStatus" class="def">matchStatus</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a></dfn><div class="doc empty">&nbsp;</div></li><li><dfn class="src"><a id="v:matchHeaders" class="def">matchHeaders</a> :: [<a href="Test-Hspec-Wai.html#t:MatchHeader">MatchHeader</a>]</dfn><div class="doc empty">&nbsp;</div></li><li><dfn class="src"><a id="v:matchBody" class="def">matchBody</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></dfn><div class="doc empty">&nbsp;</div></li></ul></div></td></tr></table></div><div class="subs instances"><p id="control.i:ResponseMatcher" class="caption collapser" onclick="toggleSection('i:ResponseMatcher')">Instances</p><div id="section.i:ResponseMatcher" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ResponseMatcher:Num:1" class="instance expander" onclick="toggleSection('i:id:ResponseMatcher:Num:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Num">Num</a> <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a></span> <a href="src/Test-Hspec-Wai-Matcher.html#line-34" class="link">Source</a> <a href="#t:ResponseMatcher" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ResponseMatcher:Num:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-43-">(+)</a> :: <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:-43-" class="selflink">#</a></p><p class="src"><a href="#v:-45-">(-)</a> :: <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:-45-" class="selflink">#</a></p><p class="src"><a href="#v:-42-">(*)</a> :: <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:-42-" class="selflink">#</a></p><p class="src"><a href="#v:negate">negate</a> :: <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:negate" class="selflink">#</a></p><p class="src"><a href="#v:abs">abs</a> :: <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:abs" class="selflink">#</a></p><p class="src"><a href="#v:signum">signum</a> :: <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:signum" class="selflink">#</a></p><p class="src"><a href="#v:fromInteger">fromInteger</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:fromInteger" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:ResponseMatcher:IsString:2" class="instance expander" onclick="toggleSection('i:id:ResponseMatcher:IsString:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:IsString">IsString</a> <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a></span> <a href="src/Test-Hspec-Wai-Matcher.html#line-31" class="link">Source</a> <a href="#t:ResponseMatcher" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:ResponseMatcher:IsString:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromString">fromString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Test-Hspec-Wai.html#t:ResponseMatcher">ResponseMatcher</a> <a href="#v:fromString" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:MatchHeader" class="def">MatchHeader</a> <a href="src/Test-Hspec-Wai-Matcher.html#MatchHeader" class="link">Source</a> <a href="#t:MatchHeader" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:MatchHeader" class="def">MatchHeader</a> ([<a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:Header">Header</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>)</td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><a id="v:-60-:-62-" class="def">(&lt;:&gt;)</a> :: <a href="file:///usr/share/doc/libghc-http-types-doc/html/Network-HTTP-Types-Header.html#t:HeaderName">HeaderName</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="Test-Hspec-Wai.html#t:MatchHeader">MatchHeader</a> <a href="src/Test-Hspec-Wai-Matcher.html#%3C%3A%3E" class="link">Source</a> <a href="#v:-60-:-62-" class="selflink">#</a></p></div><h1 id="g:5">Helpers and re-exports</h1><div class="top"><p class="src"><a id="v:liftIO" class="def">liftIO</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <span class="keyword">forall</span> a. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> a -&gt; m a <a href="#v:liftIO" class="selflink">#</a></p><div class="doc"><p>Lift a computation from the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a></code> monad.</p></div></div><div class="top"><p class="src"><a id="v:with" class="def">with</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> a -&gt; <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:SpecWith">SpecWith</a> a -&gt; <a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#t:Spec">Spec</a> <a href="src/Test-Hspec-Wai.html#with" class="link">Source</a> <a href="#v:with" class="selflink">#</a></p><div class="doc"><p>An alias for <code><a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Hooks.html#v:before">before</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:pending" class="def">pending</a> :: <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> () <a href="src/Test-Hspec-Wai.html#pending" class="link">Source</a> <a href="#v:pending" class="selflink">#</a></p><div class="doc"><p>A lifted version of <code><a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#v:pending">pending</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:pendingWith" class="def">pendingWith</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Test-Hspec-Wai.html#t:WaiSession">WaiSession</a> () <a href="src/Test-Hspec-Wai.html#pendingWith" class="link">Source</a> <a href="#v:pendingWith" class="selflink">#</a></p><div class="doc"><p>A lifted version of <code><a href="file:///usr/share/doc/libghc-hspec-core-doc/html/Test-Hspec-Core-Spec.html#v:pendingWith">pendingWith</a></code>.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>