Permalink
Browse files
feat(configure): Add restOptions param to registerEndpoint
- Loading branch information...
Showing
with
7 additions
and
2 deletions.
-
+7
−2
src/config.js
|
@@ -32,15 +32,20 @@ export class Config { |
|
|
|
* @param {string} name The name of the new endpoint. |
|
|
|
* @param {Function|string} [configureMethod] Endpoint url or configure method for client.configure(). |
|
|
|
* @param {{}} [defaults] New defaults for the HttpClient |
|
|
|
* @param {{}} [restOptions] Options to pass when constructing the Rest instance. |
|
|
|
* |
|
|
|
* @see http://aurelia.io/docs.html#/aurelia/fetch-client/latest/doc/api/class/HttpClientConfiguration |
|
|
|
* @return {Config} this Fluent interface |
|
|
|
* @chainable |
|
|
|
*/ |
|
|
|
registerEndpoint(name: string, configureMethod?: string|Function, defaults?: {}): Config { |
|
|
|
registerEndpoint(name: string, configureMethod?: string|Function, defaults?: {}, restOptions?: {useTraditionalUriTemplates?: boolean}): Config { |
|
|
|
let newClient = new HttpClient(); |
|
|
|
let useTraditionalUriTemplates; |
|
|
|
|
|
|
|
this.endpoints[name] = new Rest(newClient, name); |
|
|
|
if (restOptions !== undefined) { |
|
|
|
useTraditionalUriTemplates = restOptions.useTraditionalUriTemplates; |
|
|
|
} |
|
|
|
this.endpoints[name] = new Rest(newClient, name, useTraditionalUriTemplates); |
|
|
|
|
|
|
|
// set custom defaults to Rest |
|
|
|
if (defaults !== undefined) { |
|
|
0 comments on commit
886e3e0