<commit_before>import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';

@Injectable()
export class AddWorkFlowService {

  private stackWorkItemUrl = 'http://demo.api.almighty.io/api/workitems';
  private authoBearerToken = `<KEY>`;

  constructor(private http: Http) { }

  addWorkFlow(workItemData: any): Observable<any> {

    let headers = new Headers({ 'Content-Type': 'application/json',
                                'Authorization': this.authoBearerToken });
    let options = new RequestOptions({ headers: headers });
    let body = JSON.stringify(workItemData);
    return this.http.post(this.stackWorkItemUrl, body, options)
      .map(this.extractData)
      .catch(this.handleError);
  }

  private extractData(res: Response) {
    let body = res.json();
    return body || {};
  }

  private handleError(error: Response | any) {
    // In a real world app, we might use a remote logging infrastructure<commit_msg>changed token to testuser token provided<commit_after>import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';

@Injectable()
export class AddWorkFlowService {

  private stackWorkItemUrl = 'http://demo.api.almighty.io/api/workitems';
  private authoBearerToken = `<KEY>`;

  constructor(private http: Http) { }

  addWorkFlow(workItemData: any): Observable<any> {

    let headers = new Headers({ 'Content-Type': 'application/json',
                                'Authorization': this.authoBearerToken });
    let options = new RequestOptions({ headers: headers });
    let body = JSON.stringify(workItemData);
    return this.http.post(this.stackWorkItemUrl, body, options)
      .map(this.extractData)
      .catch(this.handleError);
  }

  private extractData(res: Response) {
    let body = res.json();
    return body || {};
  }

  private handleError(error: Response | any) {
    // In a real world app, we might use a remote logging infrastructure
{'fraction_non_alphanumeric': 0.12718316166592028, 'fraction_numerical': 0.0, 'mean_word_length': 3.733050847457627, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5627288', 'n_tokens_mistral': 667, 'n_tokens_neox': 646, 'n_words': 168}