Example #1
0
 private createRequest(type: string,data ?: Object) : Observable<any> {
   let _url : string = this.buildUrl(data);
   let _request : Observable<any>
   let stringParam : string = '';
   let _jsonBuild : any = {}
   if(_url.split('?')[1] && _url.split('?')[1].length) {
     (_url.split('?')[1].split('&')).forEach( _paramPart => {
       _jsonBuild[_paramPart.split('=')[0]] = _paramPart.split('=')[1];
     });
     stringParam = JSON.stringify(_jsonBuild);
   }
   switch (type) {
     case "post":
       _request = this._http.post(_url.split('?')[0], stringParam);
       break;
     case "patch":
       _request = this._http.patch(_url.split('?')[0], stringParam);
       break;
     case "put":
       _request = this._http.put(_url.split('?')[0], stringParam);
       break;
     case "delete":
       _request = this._http.delete(_url);
       break;
     case "head":
       _request = this._http.head(_url);
       break;
     default:
       _request = this._http.get(_url);
       break;
   }
   this._request = _request.map((response: Response) => response.json());
   return this._request;
 }
Example #2
0
 public head(url: string, paramMap?: any): Observable<Response> {
   return this.http.head(url, new RequestOptions({
     search: HttpService.buildURLSearchParams(paramMap),
     headers: new Headers({
       'token': this.globalData.token
     })
   }));
 }
	head(endpoint: string, options?: RequestOptionsArgs) : Observable<Response>{
		let url = this.getUrl(endpoint);

		return this.http.head(url, options);
	}
Example #4
0
 return this.getData(url, options, (url: string, options: RequestOptionsArgs) => {
     return this.http.head(url, options);
 });
Example #5
0
 checkProjectExists(projectName: string): Observable<any> {
   return this.http
              .head(`/api/projects/?project_name=${projectName}`)
              .map(response=>response.status)
              .catch(error=>Observable.throw(error));
 }
Example #6
0
 head(url: string, options?: RequestOptionsArgs): Observable<Response> {
   return this.http.head(url, this.attachAuthHeaders(options));
 }
 head(url: string, options?: RequestOptionsArgs): Observable<Response> {
     return this.http.head(url, this.appendHeaders(options))
         .catch((error) => {return this.handleError(error); });
 }
Example #8
0
 httpHead(url: string, options = {}) {
   return this.http.head(this.getFullUrl(url), options);
 }
Example #9
0
 public head(url: string, options?: RequestOptionsArgs) {
   if (this.networkService.noConnection()) {
     this.networkService.showNetworkAlert();
   } else { return this.http.head(url, options) }
 }
Example #10
0
 return new Promise((resolve, reject) => {
   this.handleRequest(this.http.head(LoopbackAPI.URL(url, params)), resolve, reject);
 });