當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Http.head方法代碼示例

本文整理匯總了TypeScript中angular2/http.Http.head方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Http.head方法的具體用法?TypeScript Http.head怎麽用?TypeScript Http.head使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angular2/http.Http的用法示例。


在下文中一共展示了Http.head方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: createRequest

 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;
 }
開發者ID:iloveyo123u1,項目名稱:ng2-resource,代碼行數:34,代碼來源:index.ts

示例2: initToken

 initToken() {
     console.log('initializing token');
     this.http.head(this.headUrl)
         .subscribe(
             data=> {
                 console.log(data.headers.keys());
                 this.headerName = data.headers.get('X-CSRF-HEADER');
                 this.headerValue = data.headers.get('X-CSRF-TOKEN');
                 console.log("Header name: " + this.headerName + " headerValue: " + this.headerValue);
             }
         );
 }
開發者ID:xs2maverick,項目名稱:transport,代碼行數:12,代碼來源:csrfService.ts

示例3: head

 head(url: string, options?: RequestOptionsArgs): Observable<Response> {
     url = this.buildUrl(url);
     options = this.prepareOptions(options);
     return this._http.head(url, options);
 }
開發者ID:artiso-solutions,項目名稱:vokabelchef-web,代碼行數:5,代碼來源:authenticatedHttp.ts

示例4: head

 head(url:string, options?:RequestOptionsArgs):Observable<Response> {
   return this.http.head(url, mergeAuthToken(options));
 }
開發者ID:hollannikas,項目名稱:ssoidh-angular2,代碼行數:3,代碼來源:http-client.ts

示例5: head

 protected head(route: string, obj : any) {
     return this._http.head(this._serviceBaseRouteName + route, obj);
 }    
開發者ID:IuliaUngur,項目名稱:catan,代碼行數:3,代碼來源:application.service.ts


注:本文中的angular2/http.Http.head方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。