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


TypeScript http.HttpHeaders類代碼示例

本文整理匯總了TypeScript中@angular/common/http.HttpHeaders的典型用法代碼示例。如果您正苦於以下問題:TypeScript HttpHeaders類的具體用法?TypeScript HttpHeaders怎麽用?TypeScript HttpHeaders使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: list_domain_operators

  public list_domain_operators(pretty?: boolean): Observable<DomainOperator[]>
  {
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<DomainOperator[]>(`${this.backend.url_for('api')}/clips-executive/domain-operators`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例2: get_graph

  public get_graph(pretty?: boolean): Observable<TransformsGraph>
  {
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<TransformsGraph>(`${this.backend.url_for('api')}/transforms/graph`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例3: list_images

  public list_images(pretty?: boolean): Observable<ImageInfo[]>
  {
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<ImageInfo[]>(`${this.backend.url_for('api')}/images`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例4: load

  load(param) {

    if (this.data) {
      return this.data;
    }

    const body = {
      'longUrl': param
    };
    const link = `https://www.googleapis.com/urlshortener/v1/url?key=${this.key}`;
    console.log(link);
    const headers = new HttpHeaders();
    headers.append('Content-Type', 'application/json');
    return this.data = this.http.post(link, body, { headers: headers });
  }
開發者ID:Meistercoach83,項目名稱:sfw,代碼行數:15,代碼來源:url-shortener.service.ts

示例5: getDepartment

 getDepartment() {
   let url = `${environment.url}userMetaValues?meta=department`;
   let headers = new HttpHeaders();
   let params = new HttpParams();
  
 //  params = params.append('department', 'product');
 //  params = params.append('department', 'Dept');
  // params['order-by'] = 'firstName,desc';
   headers = headers.set('X-Jwt-Token',environment.token);
   //console.log(headers.get('X-Jwt-Token'));
   return this.http.get(url, {
     headers: headers,
     params: params
   });
 }
開發者ID:pssubashps,項目名稱:angular-filter-demo,代碼行數:15,代碼來源:api.service.ts

示例6: delete

 public delete(topic: Topic): Observable<{}> {
     let headers = new HttpHeaders();
     headers.append('Content-Type', 'application/x-www-form-urlencoded');
     let data = 'id=' + topic.id;
     return this.http
         .post(this.appBaseUrl + '/Delete', data, {
             headers: headers
         }).pipe(
         map(this.extractData));
         //.subscribe({
             //next: x => console.log('Observer got a next value: ' + x),
             //error: err => alert(JSON.stringify(err)),
             //complete: () => console.log('Saved completed.'),
         //});
 }
開發者ID:jasebanico,項目名稱:banico,代碼行數:15,代碼來源:topic.service.ts

示例7: sendContactEmail

 public sendContactEmail(contact: Contact, message: string): Observable<{}> {
     let headers = new HttpHeaders();
     headers.append('Content-Type', 'application/x-www-form-urlencoded');
     let data = 'id=' + contact.id + '&message=' + message;
     return this.http
         .post(this.appBaseUrl + '/SendContactEmail', data, {
             headers: headers
         }).pipe(
         map(this.extractData));
         //.subscribe({
             //next: x => console.log('Observer got a next value: ' + x),
             //error: err => alert(JSON.stringify(err)),
             //complete: () => console.log('Saved completed.'),
         //});
 }
開發者ID:jasebanico,項目名稱:banico,代碼行數:15,代碼來源:contact.service.ts

示例8: submitRequest

  public submitRequest(request: any): Observable<any> {

    console.log('submitRequest');
    console.log(this.globals_service.site.restApiUrl);
    console.log(request);

    let header = new HttpHeaders();
    header.append('Content-Type', 'application/json');

    return this.authHttp.put(
      this.globals_service.site.restApiUrl + '/requests',
      JSON.stringify({request:request}),
      {headers:header}
    );
    // .map(res => res.json());
  }
開發者ID:RAPD,項目名稱:RAPD,代碼行數:16,代碼來源:requests.service.ts

示例9: get_skill

  public get_skill(id: string, pretty?: boolean): Observable<Skill>
  {
    if (id === null || id == undefined) {
      throw new Error("Required parameter id is null or undefined (get_skill)");
    }
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<Skill>(`${this.backend.url_for('api')}/skiller/skills/${encodeURIComponent(String(id))}`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:16,代碼來源:

示例10: header

 /**
  * 添加Http頭
  * @param name 名稱
  * @param value 值
  */
 header(name: string, value): HttpRequest<T> {
     let stringValue = "";
     if (value !== undefined && value !== null)
         stringValue = String(value);
     this.headers = this.headers.append(name, stringValue);
     return this;
 }
開發者ID:zousq19910623,項目名稱:Util,代碼行數:12,代碼來源:http-helper.ts


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