Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
feat(configure): Add restOptions param to registerEndpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
pfurini committed Oct 28, 2016
1 parent 6ec48b4 commit 886e3e0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/config.js
Expand Up @@ -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) {
Expand Down

0 comments on commit 886e3e0

Please sign in to comment.