當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。