website/docs/ddoc/primitives/handy_http_primitives.reque...

42 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>ServerHttpRequest (handy_http_primitives.request.ServerHttpRequest)</title>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<link href="style.css" rel="stylesheet" />
<script src="script.js" type="text/javascript"></script>
<link href="search-results.html" rel="prefetch" />
</head>
<body>
<div id="page-header">
<div id="logotype">
<span>Documentation</span>
<nav>
<a href="http://dlang.org/">Dlang.org</a>
</nav>
</div>
<form action="search-docs.html" id="search">
<input name="searchTerm" placeholder="Find a symbol name..." type="search" />
<input type="submit" value="Go" />
</form>
</div>
<div id="page-body">
<div id="page-content">
<h1>ServerHttpRequest</h1><div class="breadcrumbs"><a class="breadcrumb" href="handy_http_primitives.html">handy_http_primitives</a> <a class="breadcrumb" href="handy_http_primitives.request.html">request</a> </div><div><div class="documentation-comment synopsis"><div><p>The HTTP request struct which represents the content of an HTTP request as
received by a server.</p></div></div></div><div class="annotated-prototype"><div class="aggregate-prototype"><div class="attributes"></div><span class="builtin-type">struct</span> ServerHttpRequest {<div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.httpVersion.html"><div class="attributes">const </div><tt class="highlighted"><span class="hid">HttpVersion</span></tt> <span class="name">httpVersion</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.clientAddress.html"><div class="attributes">const </div><tt class="highlighted"><span class="hid">ClientAddress</span></tt> <span class="name">clientAddress</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.method.html"><div class="attributes">const </div><tt class="highlighted"><span class="type">string</span></tt> <span class="name">method</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.url.html"><div class="attributes">const </div><tt class="highlighted"><span class="type">string</span></tt> <span class="name">url</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.headers.html"><div class="attributes"></div><tt class="highlighted"><span class="kwrd">const</span>(<span class="type">string</span>[][<span class="type">string</span>])</tt> <span class="name">headers</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.queryParams.html"><div class="attributes">const </div><tt class="highlighted"><span class="hid">QueryParameter</span>[]</tt> <span class="name">queryParams</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.inputStream.html"><div class="attributes"></div><tt class="highlighted"><span class="hid">InputStream</span>!<span class="type">ubyte</span></tt> <span class="name">inputStream</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.contextData.html"><div class="attributes"></div><tt class="highlighted"><span class="hid">Object</span>[<span class="type">string</span>]</tt> <span class="name">contextData</span>;</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.getHeaderAs.html"><tt class="highlighted"><span class="hid">T</span></tt> <span class="name">getHeaderAs</span>(string headerName, T defaultValue);</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.getParamAs.html"><tt class="highlighted"><span class="hid">T</span></tt> <span class="name">getParamAs</span>(string paramName, T defaultValue);</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.readBody.html"><tt class="highlighted"><span class="hid">StreamResult</span></tt> <span class="name">readBody</span>(S outputStream, bool allowInfiniteRead);</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.readBodyAsBytes.html"><tt class="highlighted"><span class="type">ubyte</span>[]</tt> <span class="name">readBodyAsBytes</span>(bool allowInfiniteRead);</a></div><div class="aggregate-member"><a href="handy_http_primitives.request.ServerHttpRequest.readBodyAsString.html"><tt class="highlighted"><span class="type">string</span></tt> <span class="name">readBodyAsString</span>(bool allowInfiniteRead);</a></div>}</div></div><h2 id="members"><a class="header-anchor" href="#members">Members</a></h2><h3 class="member-list-header hide-from-toc" id="function"><a class="header-anchor" href="#function">Functions</a></h3><dl class="member-list native"><dt><a href="handy_http_primitives.request.ServerHttpRequest.getHeaderAs.html">getHeaderAs</a><div class="simplified-prototype" style="max-width: 52ch;"><tt class="highlighted"><span class="hid">T</span></tt> <span class="name">getHeaderAs</span>(string headerName, T defaultValue)</div></dt><dd><div><p>Gets a header as the specified type, or returns the default value if the
header doesn't exist or cannot be converted to the desired type.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.getParamAs.html">getParamAs</a><div class="simplified-prototype" style="max-width: 50ch;"><tt class="highlighted"><span class="hid">T</span></tt> <span class="name">getParamAs</span>(string paramName, T defaultValue)</div></dt><dd><div><p>Gets a query parameter with a given name, as the specified type, or
returns the default value if the parameter doesn't exist.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.readBody.html">readBody</a><div class="simplified-prototype" style="max-width: 67ch;"><tt class="highlighted"><span class="hid">StreamResult</span></tt> <span class="name">readBody</span>(S outputStream, bool allowInfiniteRead)</div></dt><dd><div><p>Reads the body of this request and transfers it to the given output
stream, limited by the request's &quot;Content-Length&quot; unless you choose to
allow infinite reading. If the request includes a header for
&quot;Transfer-Encoding: chunked&quot;, then it will wrap the input stream in one
which decodes HTTP chunked-encoding first.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.readBodyAsBytes.html">readBodyAsBytes</a><div class="simplified-prototype" style="max-width: 51ch;"><tt class="highlighted"><span class="type">ubyte</span>[]</tt> <span class="name">readBodyAsBytes</span>(bool allowInfiniteRead)</div></dt><dd><div><p>Reads the request's body into a new byte array.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.readBodyAsString.html">readBodyAsString</a><div class="simplified-prototype" style="max-width: 51ch;"><tt class="highlighted"><span class="type">string</span></tt> <span class="name">readBodyAsString</span>(bool allowInfiniteRead)</div></dt><dd><div><p>Reads the request's body into a new string.</p></div></dd></dl><h3 class="member-list-header hide-from-toc" id="variable"><a class="header-anchor" href="#variable">Variables</a></h3><dl class="member-list native"><dt><a href="handy_http_primitives.request.ServerHttpRequest.clientAddress.html">clientAddress</a><div class="simplified-prototype" style="max-width: 30ch;"><tt class="highlighted"><span class="hid">ClientAddress</span></tt> <span class="name">clientAddress</span>;</div></dt><dd><div><p>The remote address of the client that sent this request.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.contextData.html">contextData</a><div class="simplified-prototype" style="max-width: 29ch;"><tt class="highlighted"><span class="hid">Object</span>[<span class="type">string</span>]</tt> <span class="name">contextData</span>;</div></dt><dd><div><p>Any additional data about this request that may be populated during handling.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.headers.html">headers</a><div class="simplified-prototype" style="max-width: 35ch;"><tt class="highlighted"><span class="kwrd">const</span>(<span class="type">string</span>[][<span class="type">string</span>])</tt> <span class="name">headers</span>;</div></dt><dd><div><p>A case-insensitive map of all request headers.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.httpVersion.html">httpVersion</a><div class="simplified-prototype" style="max-width: 26ch;"><tt class="highlighted"><span class="hid">HttpVersion</span></tt> <span class="name">httpVersion</span>;</div></dt><dd><div><p>The HTTP version of the request.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.inputStream.html">inputStream</a><div class="simplified-prototype" style="max-width: 33ch;"><tt class="highlighted"><span class="hid">InputStream</span>!<span class="type">ubyte</span></tt> <span class="name">inputStream</span>;</div></dt><dd><div><p>The underlying stream used to read the body from the request.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.method.html">method</a><div class="simplified-prototype" style="max-width: 15ch;"><tt class="highlighted"><span class="type">string</span></tt> <span class="name">method</span>;</div></dt><dd><div><p>The HTTP verb used in the request.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.queryParams.html">queryParams</a><div class="simplified-prototype" style="max-width: 31ch;"><tt class="highlighted"><span class="hid">QueryParameter</span>[]</tt> <span class="name">queryParams</span>;</div></dt><dd><div><p>A list of all URL query parameters.</p></div></dd><dt><a href="handy_http_primitives.request.ServerHttpRequest.url.html">url</a><div class="simplified-prototype" style="max-width: 12ch;"><tt class="highlighted"><span class="type">string</span></tt> <span class="name">url</span>;</div></dt><dd><div><p>The URL that was requested, excluding any query parameters.</p></div></dd></dl><div></div></div>
<div id="page-nav"><a class="parent" href="handy_http_primitives.html">handy_http_primitives</a> <a class="parent" href="handy_http_primitives.request.html">request</a>
<span class="type-separator">enums</span><ul><li><a class="enum" href="handy_http_primitives.request.HttpMethod.html">HttpMethod</a></li><li><a class="enum" href="handy_http_primitives.request.HttpVersion.html">HttpVersion</a></li></ul><span class="type-separator">functions</span><ul><li><a class="function" href="handy_http_primitives.request.parseQueryParameters.html">parseQueryParameters</a></li></ul><span class="type-separator">structs</span><ul><li><a class="struct" href="handy_http_primitives.request.QueryParameter.html">QueryParameter</a></li><li><a class="struct current" href="handy_http_primitives.request.ServerHttpRequest.html">ServerHttpRequest</a></li></ul></div>
</div>
<div id="page-footer">Page generated by <a href="https://github.com/adamdruppe/adrdox">adrdox</a></div>
</body>
</html>