<commit_before>import {
    async,
    getTestBed,
    TestBed
} from '@angular/core/testing';

import "rxjs/add/operator/map";

import xhrMock from 'xhr-mock';

import { HttpModule } from "@angular/http";

import { ProgressHttpModule, ProgressHttp } from "angular-progress-http";

describe("ProgressHttp Service", () => {
    let progressHttp;

    beforeEach(async(() => {
        xhrMock.setup();

        TestBed.configureTestingModule({
            imports: [
                HttpModule,
                ProgressHttpModule
            ]
        });

        const testBed = getTestBed();
        progressHttp = testBed.get(ProgressHttp);
    }));

    afterEach(() => {
        xhrMock.teardown();
    })

    it("performs get requests as usual Http", (done) => {
        xhrMock.get("/data", (req, res) => {
            res.body(JSON.stringify({
                field: "value"
            }));

            return res;
        });

        progressHttp
            .get("/data")
            .map(response => response.json())
            .subscribe(response => {
                expect(response.field).toEqual("value");
                done();
            })
    });
});<commit_msg>Added test for post request<commit_after>import {
    async,
    getTestBed,
    TestBed
} from '@angular/core/testing';

import "rxjs/add/operator/map";

import xhrMock from 'xhr-mock';

import { HttpModule } from "@angular/http";

import { ProgressHttpModule, ProgressHttp } from "angular-progress-http";

describe("ProgressHttp Service", () => {
    let progressHttp;

    beforeEach(async(() => {
        xhrMock.setup();

        TestBed.configureTestingModule({
            imports: [
                HttpModule,
                ProgressHttpModule
            ]
        });

        const testBed = getTestBed();
        progressHttp = testBed.get(ProgressHttp);
    }));

    afterEach(() => {
        xhrMock.teardown();
    });

    it("performs get requests as usual Http", (done) => {
        xhrMock.get("/data", (req, res) => {
            res.body(JSON.stringify({
                field: "value"
            }));

            return res;
        });

        progressHttp
            .get("/data")
            .map(response => response.json())
            .subscribe(response => {
                expect(response.field).toEqual("value");
                done();
            });
    });

    it("performs post requests as usual Http", (done) => {
        xhrMock.post("/data", (req, res) => {
            expect(req.header("Content-Type")).toEqual("application/json");

            const body = JSON.parse(req.body());
            expect(body.field).toEqual("value");

            res.body("reply");
            return res;
        });

        progressHttp
            .post("/data", { field: "value" })
            .map(response => response.text())
            .subscribe((response) => {
                expect(response).toEqual("reply");
                done();
            });
    })
});
{'fraction_non_alphanumeric': 0.14978268137746573, 'fraction_numerical': 0.0, 'mean_word_length': 1.73992673992674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '521695', 'n_tokens_mistral': 837, 'n_tokens_neox': 803, 'n_words': 151}