<commit_before>import { MockBackend } from '@angular/http/testing';
import { AuthenticationService } from 'ngx-login-client';
import {
  Injectable,
  ReflectiveInjector
} from '@angular/core';
import {
  Http,
  XHRBackend,
  RequestOptions,
  Request,
  RequestOptionsArgs,
  Response,
  Headers
} from '@angular/http';

import { Observable } from 'rxjs/Observable';

/**
 * This class is an abstract of Angular2 HTTP
 * Extended from Angular2 HTTP
 *
 * Purpose:
 * Error handling on API services
 * To implement a general retry logic
 */

@Injectable()
export class HttpService extends Http {

  private headers = new Headers({'Content-Type': 'application/json'});
  constructor (
    backend: any,
    options: RequestOptions,
    auth: AuthenticationService
  ) {
    super(backend, options);
    if (auth && auth.getToken() != null) {
      options.headers.set('Authorization', `Bearer ${auth.getToken()}`);
    }
  }

  get(url: string, options?: RequestOptionsArgs) {
    console.log('GET request initiated');
    console.log('URL - ', url);
    console.log('Options - ', options);

    return super.get(url, options);
  }

  post(url: string, body: any, options?: RequestOptionsArgs) {
    console.log('POST request initiated');
    console.log('URL - ', url);
    console.log('Body - ', body);
    console.log('Options - ', options);

    return super.post(url, body, options);
  }

  put(url: string, body: any, options?: RequestOptionsArgs) {
    console.log('PUT request initiated');
    console.log('URL - ', url);
    console.log('Body - ', body);
    console.log('Options - ', options);

    return super.post(url, body, options);
  }

  patch(url: string, body: any, options?: RequestOptionsArgs) {
    console.log('PATCH request initiated');
    console.log('URL - ', url);
    console.log('Body - ', body);
    console.log('Options - ', options);

    return super.post(url, body, options);
  }

}
<commit_msg>fix(http calls): Fix PUT and PATCH calls (#1304 & #1288).<commit_after>import { MockBackend } from '@angular/http/testing';
import { AuthenticationService } from 'ngx-login-client';
import {
  Injectable,
  ReflectiveInjector
} from '@angular/core';
import {
  Http,
  XHRBackend,
  RequestOptions,
  Request,
  RequestOptionsArgs,
  Response,
  Headers
} from '@angular/http';

import { Observable } from 'rxjs/Observable';

/**
 * This class is an abstract of Angular2 HTTP
 * Extended from Angular2 HTTP
 *
 * Purpose:
 * Error handling on API services
 * To implement a general retry logic
 */

@Injectable()
export class HttpService extends Http {

  private headers = new Headers({'Content-Type': 'application/json'});
  constructor (
    backend: any,
    options: RequestOptions,
    auth: AuthenticationService
  ) {
    super(backend, options);
    if (auth && auth.getToken() != null) {
      options.headers.set('Authorization', `Bearer ${auth.getToken()}`);
    }
  }

  get(url: string, options?: RequestOptionsArgs) {
    console.log('GET request initiated');
    console.log('URL - ', url);
    console.log('Options - ', options);

    return super.get(url, options);
  }

  post(url: string, body: any, options?: RequestOptionsArgs) {
    console.log('POST request initiated');
    console.log('URL - ', url);
    console.log('Body - ', body);
    console.log('Options - ', options);

    return super.post(url, body, options);
  }

  put(url: string, body: any, options?: RequestOptionsArgs) {
    console.log('PUT request initiated');
    console.log('URL - ', url);
    console.log('Body - ', body);
    console.log('Options - ', options);

    return super.put(url, body, options);
  }

  patch(url: string, body: any, options?: RequestOptionsArgs) {
    console.log('PATCH request initiated');
    console.log('URL - ', url);
    console.log('Body - ', body);
    console.log('Options - ', options);

    return super.patch(url, body, options);
  }

}

{'fraction_non_alphanumeric': 0.14984631147540983, 'fraction_numerical': 0.0030737704918032786, 'mean_word_length': 3.577960140679953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5692903', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1179, 'n_words': 306}