<commit_before>var WebKit = require('../');
var expect = require('expect.js');
var fs = require('fs');

describe("response handler data method", function suite() {
	it("should get data from the response", function(done) {
		this.timeout(5000);
		WebKit().load("https://www.debian.org/logos/openlogo-nd-100.png").on("response", function(response) {
			if (response.uri == this.uri) {
				response.data(function(err, data) {
					expect(data.slice(1, 4).toString()).to.be("PNG");
					expect(data.length).to.be.greaterThan(1000);
					done();
				});
			}
		});
	});
});

<commit_msg>Add tests for response properties<commit_after>var WebKit = require('../');
var expect = require('expect.js');
var fs = require('fs');

describe("response handler data method", function suite() {
	it("should get data from the response", function(done) {
		this.timeout(5000);
		WebKit().load("https://www.debian.org/logos/openlogo-nd-100.png").on("response", function(response) {
			if (response.uri == this.uri) {
				response.data(function(err, data) {
					expect(data.slice(1, 4).toString()).to.be("PNG");
					expect(data.length).to.be.greaterThan(1000);
					done();
				});
			}
		});
	});
	it("should get headers from the response", function(done) {
		this.timeout(5000);
		WebKit().load("https://www.debian.org/logos/openlogo-nd-100.png").on("response", function(response) {
			if (response.uri == this.uri) {
				expect(response.headers['Content-Type']).to.be('image/png');
				expect(Object.keys(response.headers).length).to.be.greaterThan(3);
				done();
			}
		});
	});
	it("should get length status mime and filename from the response", function(done) {
		this.timeout(5000);
		WebKit().load("https://www.debian.org/logos/openlogo-nd-100.png").on("response", function(response) {
			if (response.uri == this.uri) {
				expect(response.mime).to.be('image/png');
				expect(response.status).to.be(200);
				expect(response.filename).to.be(null);
				expect(response.length).to.be.greaterThan(1000);
				done();
			}
		});
	});
});
{'fraction_non_alphanumeric': 0.20503952569169961, 'fraction_numerical': 0.023715415019762844, 'mean_word_length': 4.113636363636363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '7414390', 'n_tokens_mistral': 799, 'n_tokens_neox': 666, 'n_words': 110}