|
1 |
| -# 8.4.x API Reference |
| 1 | +# 8.5.x API Reference |
2 | 2 |
|
3 | 3 | - [Server](#server)
|
4 | 4 | - [`new Server([options])`](#new-serveroptions)
|
@@ -802,6 +802,7 @@ var admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin
|
802 | 802 |
|
803 | 803 | Extends various framework interfaces with custom methods where:
|
804 | 804 | - `type` - the interface being decorated. Supported types:
|
| 805 | + - `'request'` - adds methods to the [Request object](#request-object). |
805 | 806 | - `'reply'` - adds methods to the [reply interface](#reply-interface).
|
806 | 807 | - `'server'` - adds methods to the [Server](#server) object.
|
807 | 808 | - `property` - the object decoration key name.
|
@@ -1023,8 +1024,7 @@ for performing injections, with some additional options and response properties:
|
1023 | 1024 | used to automatically set an HTTP 'Host' header, unless one was specified in `headers`.
|
1024 | 1025 | - `headers` - an object with optional request headers where each key is the header name and the
|
1025 | 1026 | value is the header content. Defaults to no additions to the default Shot headers.
|
1026 |
| - - `payload` - an optional string or buffer containing the request payload (object must be |
1027 |
| - manually converted to a string first). Defaults to no payload. Note that payload processing |
| 1027 | + - `payload` - an optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing |
1028 | 1028 | defaults to `'application/json'` if no 'Content-Type' header provided.
|
1029 | 1029 | - `credentials` - an optional credentials object containing authentication information. The
|
1030 | 1030 | `credentials` are used to bypass the default authentication strategies, and are validated
|
@@ -1761,7 +1761,9 @@ Emitted by the server `'request-internal'` event:
|
1761 | 1761 | - `auth` `unauthenticated` `response` `{strategy}` - the authentication strategy listed returned a
|
1762 | 1762 | non-error response (e.g. a redirect to a login page).
|
1763 | 1763 | - `auth` `unauthenticated` `error` `{strategy}` - the request failed to pass the listed
|
1764 |
| - authentication strategy. |
| 1764 | + authentication strategy (invalid credentials). |
| 1765 | +- `auth` `unauthenticated` `missing` `{strategy}` - the request failed to pass the listed |
| 1766 | + authentication strategy (no credentials found). |
1765 | 1767 | - `auth` `unauthenticated` `try` `{strategy}` - the request failed to pass the listed
|
1766 | 1768 | authentication strategy in `'try'` mode and will continue.
|
1767 | 1769 | - `auth` `scope` `error` `{strategy}` - the request authenticated but failed to meet the scope
|
@@ -1894,14 +1896,14 @@ Each incoming request passes through a pre-defined list of steps, along with opt
|
1894 | 1896 | - JSONP configuration is ignored for any response returned from the extension point since no
|
1895 | 1897 | route is matched yet and the JSONP configuration is unavailable.
|
1896 | 1898 | - Lookup route using request path
|
| 1899 | +- Process query extensions (e.g. JSONP) |
1897 | 1900 | - Parse cookies
|
1898 | 1901 | - **`'onPreAuth'`** extension point
|
1899 | 1902 | - Authenticate request
|
1900 | 1903 | - Read and parse payload
|
1901 | 1904 | - Authenticate request payload
|
1902 | 1905 | - **`'onPostAuth'`** extension point
|
1903 | 1906 | - Validate path parameters
|
1904 |
| -- Process query extensions (e.g. JSONP) |
1905 | 1907 | - Validate query
|
1906 | 1908 | - Validate payload
|
1907 | 1909 | - **`'onPreHandler'`** extension point
|
@@ -2017,7 +2019,10 @@ following options:
|
2017 | 2019 | - `scope` - the application scope required to access the route. Value can be a scope
|
2018 | 2020 | string or an array of scope strings. The authenticated credentials object `scope`
|
2019 | 2021 | property must contain at least one of the scopes defined to access the route.
|
2020 |
| - Set to `false` to remove scope requirements. Defaults to no scope required. |
| 2022 | + You may also access properties on the request object (`query` and `params`} to populate a |
| 2023 | + dynamic scope by using `{}` characters around the property name, such as |
| 2024 | + `'user-{params.id}'`. Set to `false` to remove scope requirements. Defaults to no scope |
| 2025 | + required. |
2021 | 2026 | - `entity` - the required authenticated entity type. If set, must match the `entity`
|
2022 | 2027 | value of the authentication credentials. Available values:
|
2023 | 2028 | - `any` - the authentication can be on behalf of a user or application. This is the
|
@@ -2109,7 +2114,7 @@ following options:
|
2109 | 2114 | values are presented as text while files are provided as streams. File streams from a
|
2110 | 2115 | 'multipart/form-data' upload will also have a property `hapi` containing `filename`
|
2111 | 2116 | and `headers` properties.
|
2112 |
| - - `'file'` - the incoming payload in written to temporary file in the directory |
| 2117 | + - `'file'` - the incoming payload is written to temporary file in the directory |
2113 | 2118 | specified by the server's `payload.uploads` settings. If the payload is
|
2114 | 2119 | 'multipart/form-data' and `parse` is `true`, fields values are presented as text
|
2115 | 2120 | while files are saved. Note that it is the sole responsibility of the application to
|
@@ -2280,8 +2285,7 @@ following options:
|
2280 | 2285 | 'function(request, reply, source, error)` where:
|
2281 | 2286 | - `request` - the [request object](#request-object).
|
2282 | 2287 | - `reply` - the continuation [reply interface](#reply-interface).
|
2283 |
| - - `source` - the source of the invalid field (e.g. `'path'`, `'query'`, |
2284 |
| - `'payload'`). |
| 2288 | + - `source` - the source of the invalid field (e.g. `'headers'`, `'params'`, `'query'`, `'payload'`). |
2285 | 2289 | - `error` - the error object prepared for the client response (including the
|
2286 | 2290 | validation function error under `error.data`).
|
2287 | 2291 |
|
@@ -2718,12 +2722,15 @@ Each request object includes the following properties:
|
2718 | 2722 | definition.
|
2719 | 2723 | - `url` - the parsed request URI.
|
2720 | 2724 |
|
2721 |
| -#### `request.setUrl(url)` |
| 2725 | +#### `request.setUrl(url, [stripTrailingSlash], [qsParserOptions])` |
2722 | 2726 |
|
2723 | 2727 | _Available only in `'onRequest'` extension methods._
|
2724 | 2728 |
|
2725 | 2729 | Changes the request URI before the router begins processing the request where:
|
2726 | 2730 | - `url` - the new request path value.
|
| 2731 | + - `stripTrailingSlash` - if `true`, strip the trailing slash from the path. Defaults to `false`. |
| 2732 | + - `parserOptions` - optional URI parsing [options](https://www.npmjs.com/package/qs#parsing-objects). |
| 2733 | + Defaults to the **qs** module parsing defaults. |
2727 | 2734 |
|
2728 | 2735 | ```js
|
2729 | 2736 | var Hapi = require('hapi');
|
|
0 commit comments