Permalink
Browse files

feat(rest): Use HttpClient from DI, so config gets applied

  • Loading branch information...
RWOverdijk committed Dec 17, 2015
1 parent 6506ac2 commit 14adca60cebbd923230801702312bab80da2778c
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/rest.js
@@ -2,7 +2,17 @@ import {HttpClient, json} from 'aurelia-fetch-client';
import {inject} from 'aurelia-framework';
import qs from 'querystring';

export class Rest extends HttpClient {
@inject(HttpClient)
export class Rest {

/**
* Inject the httpClient to use for requests.
* @param {HttpClient} httpClient
*/
constructor (httpClient) {
this.client = httpClient;
}

/**
* Make a request to the server.
*
@@ -30,7 +40,7 @@ export class Rest extends HttpClient {
requestOptions.body = json(body);
}

return this.fetch(path, requestOptions).then(response => response.json());
return this.client.fetch(path, requestOptions).then(response => response.json());
}

/**

0 comments on commit 14adca6

Please sign in to comment.