diff options
Diffstat (limited to 'src/app/shared/services/httpUtil/http-util.service.ts')
-rw-r--r-- | src/app/shared/services/httpUtil/http-util.service.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/app/shared/services/httpUtil/http-util.service.ts b/src/app/shared/services/httpUtil/http-util.service.ts index 43e6d4f..688f3ea 100644 --- a/src/app/shared/services/httpUtil/http-util.service.ts +++ b/src/app/shared/services/httpUtil/http-util.service.ts @@ -28,23 +28,22 @@ import { Http, Response, Headers, RequestOptions } from '@angular/http'; export class HttpUtilService { headers: Headers; options: RequestOptions - private username = require('../../../cdt.application.properties.json').username; - private password = require('../../../cdt.application.properties.json').password; + private username = require('../../../../cdt.application.properties.json').username; + private password = require('../../../../cdt.application.properties.json').password; constructor(private http: Http) { this.headers = new Headers({ 'Content-Type': 'application/json' }); // ... Set content type to JSON - this.options = new RequestOptions({headers: this.headers}); // } - get(req) { + return this .http .get(req.url, this.options) .map((res: Response) => res.json()) } - post(req) { this.headers.append('Authorization', 'Basic ' + btoa(this.username + ':' + this.password)); this.options = new RequestOptions({ headers: this.headers }); + return this .http .post(req.url, req.data, this.options) |