当前位置: 首页>>代码示例>>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;未经允许,请勿转载。