当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript HttpClient.configure方法代码示例

本文整理汇总了TypeScript中aurelia-http-client.HttpClient.configure方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HttpClient.configure方法的具体用法?TypeScript HttpClient.configure怎么用?TypeScript HttpClient.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aurelia-http-client.HttpClient的用法示例。


在下文中一共展示了HttpClient.configure方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createPost

  createPost(text: string, options: any) {
    this.ea.publish(new ApiStatus('Creating Post', { status: 'info' }));
    var jsonText = {
      text: text,
      entities: {
        parse_links: true,
        parse_markdown_links: true
      },
      reply_to: 0
    };
    if (options.reply_to) { jsonText.reply_to = options.reply_to; }
    this.isRequesting = true;

    return this.http.configure((x: any) => {
      x.withHeader('Authorization', 'Bearer ' + this.state.token);
      x.withHeader('Content-Type', 'application/json');
    }).post(`https://api.app.net/posts`, jsonText)
      .then((response: any) => {
        this.meta = response.content.meta;
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Post Created', { status: 'success' }));
        return response.content.data;

      }).catch((err: any) => {
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Unable to post', { status: 'error' }));
        return {};
      });
  }
开发者ID:mttmccb,项目名称:dark_social,代码行数:29,代码来源:adn-api.ts

示例2: textProcess

  textProcess(text: string) {
    let jsonText = { text: text };
    this.isRequesting = true;

    return this.http.configure((x: any) => {
      x.withHeader('Authorization', 'Bearer ' + this.state.token);
      x.withHeader('Content-Type', 'application/json');
    }).post(`https://api.app.net/text/process?parse_links=true&parse_markdown_links=true`, jsonText)
      .then((response: any) => {
        this.meta = response.content.meta;
        this.isRequesting = false;
        return response.content.data;

      }).catch((err: any) => {
        this.isRequesting = false;
        return nouser.data;
      });
  }
开发者ID:mttmccb,项目名称:dark_social,代码行数:18,代码来源:adn-api.ts

示例3: setMarker

  setMarker(id: number) {
    var jsonText = {
      id: id,
      name: 'unified'
    };
    this.isRequesting = true;

    return this.http.configure((x: any) => {
      x.withHeader('Authorization', 'Bearer ' + this.state.token);
      x.withHeader('Content-Type', 'application/json');
    }).post(`https://api.app.net/posts/marker`, jsonText)
      .then((response: any) => {
        this.meta = response.content.meta;
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Marker Set', { status: 'success' }));
        return response.content.data;

      }).catch((err: any) => {
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Unable to set marker', { status: 'error' }));
        return {};
      });
  }
开发者ID:mttmccb,项目名称:dark_social,代码行数:23,代码来源:adn-api.ts

示例4: constructor

 public constructor(private httpClient: HttpClient) {
     this.httpClient.configure(f => f
         .withBaseUrl(config.webServiceUri)
         .withHeader("Content-Type", "application/json"));
 }
开发者ID:LeagueLogbook,项目名称:LogbookWebsite,代码行数:5,代码来源:summoners-api.ts

示例5: constructor

 constructor(private http: HttpClient) {
   this.http = http.configure((x: any) => {
     x.withBaseUrl('https://api.nice.social/');
   });
 }
开发者ID:mttmccb,项目名称:dark_social,代码行数:5,代码来源:nice-api.ts

示例6: configure

export function configure(frameworkConfiguration: FrameworkConfiguration, pluginConfiguration: Function) {
    let container: Container = frameworkConfiguration.container;
    let httpClient: HttpClient = container.get(HttpClient);
    httpClient.configure(x => x.withInterceptor(new JsonMessageContentInterceptor()));
}
开发者ID:heruan,项目名称:aurelia-json,代码行数:5,代码来源:index.ts

示例7: constructor

 constructor(protected http: HttpClient) {
     this.http.configure(cfg =>
         cfg.withHeader("Accept", "application/json")
             .withHeader("Content-Type", "application/json"));
 }
开发者ID:t0ms3n,项目名称:SoftwareManager,代码行数:5,代码来源:odata-base-service.ts

示例8: constructor

 constructor(private httpClient: HttpClient) {
     console.log('helllooooo');
     this.httpClient.configure(config => {
         config.withHeader('Accept', 'application/json');
     });
 }
开发者ID:Layoric,项目名称:JsonClassGenerator,代码行数:6,代码来源:dto-generator.ts


注:本文中的aurelia-http-client.HttpClient.configure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。