This commit is contained in:
c-cube 2023-08-08 20:44:30 +00:00
parent 8941b37806
commit cbc69ea178
2 changed files with 2 additions and 2 deletions

View file

@ -76,7 +76,7 @@ echo:
<span>stage:<span>[ `Encoding <span><span>| `Stage</span> of int</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Tiny_httpd_server/Middleware/index.html#type-t">Middleware.t</a> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p>Add a middleware to every request/response pair.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">stage</span> <p>specify when middleware applies. Encoding comes first (outermost layer), then stages in increasing order.</p></li></ul><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if stage is <code>`Stage n</code> where <code>n &lt; 1</code></p></li></ul><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.11</li></ul></div></div><h5 id="request-handlers"><a href="#request-handlers" class="anchor"></a>Request handlers</h5><div class="odoc-spec"><div class="spec value anchored" id="val-set_top_handler"><a href="#val-set_top_handler" class="anchor"></a><code><span><span class="keyword">val</span> set_top_handler : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span><a href="#type-byte_stream">byte_stream</a> <a href="../Tiny_httpd_server/Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <a href="../Tiny_httpd_server/Response/index.html#type-t">Response.t</a>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Setup a handler called by default.</p><p>This handler is called with any request not accepted by any handler installed via <code>add_path_handler</code>. If no top handler is installed, unhandled paths will return a <code>404</code> not found.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_route_handler"><a href="#val-add_route_handler" class="anchor"></a><code><span><span class="keyword">val</span> add_route_handler :
unit</span></code></div><div class="spec-doc"><p>Add a middleware to every request/response pair.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">stage</span> <p>specify when middleware applies. Encoding comes first (outermost layer), then stages in increasing order.</p></li></ul><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if stage is <code>`Stage n</code> where <code>n &lt; 1</code></p></li></ul><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.11</li></ul></div></div><h5 id="request-handlers"><a href="#request-handlers" class="anchor"></a>Request handlers</h5><div class="odoc-spec"><div class="spec value anchored" id="val-set_top_handler"><a href="#val-set_top_handler" class="anchor"></a><code><span><span class="keyword">val</span> set_top_handler : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span><a href="#type-byte_stream">byte_stream</a> <a href="../Tiny_httpd_server/Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <a href="../Tiny_httpd_server/Response/index.html#type-t">Response.t</a>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Setup a handler called by default.</p><p>This handler is called with any request not accepted by any handler installed via <code>add_path_handler</code>. If no top handler is installed, unhandled paths will return a <code>404</code> not found</p><p>This used to take a <code>string Request.t</code> but it now takes a <code>byte_stream Request.t</code> since NEXT_RELEASE . Use <a href="../Tiny_httpd_server/Request/index.html#val-read_body_full"><code>Request.read_body_full</code></a> to read the body into a string if needed.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_route_handler"><a href="#val-add_route_handler" class="anchor"></a><code><span><span class="keyword">val</span> add_route_handler :
<span>?accept:<span>(<span><span>unit <a href="../Tiny_httpd_server/Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(unit, <a href="../Tiny_httpd_server/Response_code/index.html#type-t">Response_code.t</a> * string)</span> <span class="xref-unresolved">Stdlib</span>.result</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span>?middlewares:<span><a href="../Tiny_httpd_server/Middleware/index.html#type-t">Middleware.t</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span>?meth:<a href="../Tiny_httpd_server/Meth/index.html#type-t">Meth.t</a> <span class="arrow">&#45;&gt;</span></span>

View file

@ -26,7 +26,7 @@
<span>stage:<span>[ `Encoding <span><span>| `Stage</span> of int</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="Middleware/index.html#type-t">Middleware.t</a> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p>Add a middleware to every request/response pair.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">stage</span> <p>specify when middleware applies. Encoding comes first (outermost layer), then stages in increasing order.</p></li></ul><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if stage is <code>`Stage n</code> where <code>n &lt; 1</code></p></li></ul><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.11</li></ul></div></div><h3 id="request-handlers"><a href="#request-handlers" class="anchor"></a>Request handlers</h3><div class="odoc-spec"><div class="spec value anchored" id="val-set_top_handler"><a href="#val-set_top_handler" class="anchor"></a><code><span><span class="keyword">val</span> set_top_handler : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span><a href="#type-byte_stream">byte_stream</a> <a href="Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <a href="Response/index.html#type-t">Response.t</a>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Setup a handler called by default.</p><p>This handler is called with any request not accepted by any handler installed via <code>add_path_handler</code>. If no top handler is installed, unhandled paths will return a <code>404</code> not found.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_route_handler"><a href="#val-add_route_handler" class="anchor"></a><code><span><span class="keyword">val</span> add_route_handler :
unit</span></code></div><div class="spec-doc"><p>Add a middleware to every request/response pair.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">stage</span> <p>specify when middleware applies. Encoding comes first (outermost layer), then stages in increasing order.</p></li></ul><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if stage is <code>`Stage n</code> where <code>n &lt; 1</code></p></li></ul><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.11</li></ul></div></div><h3 id="request-handlers"><a href="#request-handlers" class="anchor"></a>Request handlers</h3><div class="odoc-spec"><div class="spec value anchored" id="val-set_top_handler"><a href="#val-set_top_handler" class="anchor"></a><code><span><span class="keyword">val</span> set_top_handler : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span><a href="#type-byte_stream">byte_stream</a> <a href="Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <a href="Response/index.html#type-t">Response.t</a>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Setup a handler called by default.</p><p>This handler is called with any request not accepted by any handler installed via <code>add_path_handler</code>. If no top handler is installed, unhandled paths will return a <code>404</code> not found</p><p>This used to take a <code>string Request.t</code> but it now takes a <code>byte_stream Request.t</code> since NEXT_RELEASE . Use <a href="Request/index.html#val-read_body_full"><code>Request.read_body_full</code></a> to read the body into a string if needed.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_route_handler"><a href="#val-add_route_handler" class="anchor"></a><code><span><span class="keyword">val</span> add_route_handler :
<span>?accept:<span>(<span><span>unit <a href="Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(unit, <a href="Response_code/index.html#type-t">Response_code.t</a> * string)</span> <span class="xref-unresolved">Stdlib</span>.result</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span>?middlewares:<span><a href="Middleware/index.html#type-t">Middleware.t</a> list</span> <span class="arrow">&#45;&gt;</span></span>
<span>?meth:<a href="Meth/index.html#type-t">Meth.t</a> <span class="arrow">&#45;&gt;</span></span>