Skip to content

Commit ac65a4c

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master'
2 parents 75a8e6d + 93292ce commit ac65a4c

30 files changed

+1881
-337
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ config.json
1313
*/._*
1414
*/*/._*
1515
coverage.*
16+
.settings

API.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 8.4.x API Reference
1+
# 8.5.x API Reference
22

33
- [Server](#server)
44
- [`new Server([options])`](#new-serveroptions)
@@ -802,6 +802,7 @@ var admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin
802802

803803
Extends various framework interfaces with custom methods where:
804804
- `type` - the interface being decorated. Supported types:
805+
- `'request'` - adds methods to the [Request object](#request-object).
805806
- `'reply'` - adds methods to the [reply interface](#reply-interface).
806807
- `'server'` - adds methods to the [Server](#server) object.
807808
- `property` - the object decoration key name.
@@ -1023,8 +1024,7 @@ for performing injections, with some additional options and response properties:
10231024
used to automatically set an HTTP 'Host' header, unless one was specified in `headers`.
10241025
- `headers` - an object with optional request headers where each key is the header name and the
10251026
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
10281028
defaults to `'application/json'` if no 'Content-Type' header provided.
10291029
- `credentials` - an optional credentials object containing authentication information. The
10301030
`credentials` are used to bypass the default authentication strategies, and are validated
@@ -1761,7 +1761,9 @@ Emitted by the server `'request-internal'` event:
17611761
- `auth` `unauthenticated` `response` `{strategy}` - the authentication strategy listed returned a
17621762
non-error response (e.g. a redirect to a login page).
17631763
- `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).
17651767
- `auth` `unauthenticated` `try` `{strategy}` - the request failed to pass the listed
17661768
authentication strategy in `'try'` mode and will continue.
17671769
- `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
18941896
- JSONP configuration is ignored for any response returned from the extension point since no
18951897
route is matched yet and the JSONP configuration is unavailable.
18961898
- Lookup route using request path
1899+
- Process query extensions (e.g. JSONP)
18971900
- Parse cookies
18981901
- **`'onPreAuth'`** extension point
18991902
- Authenticate request
19001903
- Read and parse payload
19011904
- Authenticate request payload
19021905
- **`'onPostAuth'`** extension point
19031906
- Validate path parameters
1904-
- Process query extensions (e.g. JSONP)
19051907
- Validate query
19061908
- Validate payload
19071909
- **`'onPreHandler'`** extension point
@@ -2017,7 +2019,10 @@ following options:
20172019
- `scope` - the application scope required to access the route. Value can be a scope
20182020
string or an array of scope strings. The authenticated credentials object `scope`
20192021
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.
20212026
- `entity` - the required authenticated entity type. If set, must match the `entity`
20222027
value of the authentication credentials. Available values:
20232028
- `any` - the authentication can be on behalf of a user or application. This is the
@@ -2109,7 +2114,7 @@ following options:
21092114
values are presented as text while files are provided as streams. File streams from a
21102115
'multipart/form-data' upload will also have a property `hapi` containing `filename`
21112116
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
21132118
specified by the server's `payload.uploads` settings. If the payload is
21142119
'multipart/form-data' and `parse` is `true`, fields values are presented as text
21152120
while files are saved. Note that it is the sole responsibility of the application to
@@ -2280,8 +2285,7 @@ following options:
22802285
'function(request, reply, source, error)` where:
22812286
- `request` - the [request object](#request-object).
22822287
- `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'`).
22852289
- `error` - the error object prepared for the client response (including the
22862290
validation function error under `error.data`).
22872291

@@ -2718,12 +2722,15 @@ Each request object includes the following properties:
27182722
definition.
27192723
- `url` - the parsed request URI.
27202724

2721-
#### `request.setUrl(url)`
2725+
#### `request.setUrl(url, [stripTrailingSlash], [qsParserOptions])`
27222726

27232727
_Available only in `'onRequest'` extension methods._
27242728

27252729
Changes the request URI before the router begins processing the request where:
27262730
- `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.
27272734

27282735
```js
27292736
var Hapi = require('hapi');

0 commit comments

Comments
 (0)