New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

req-fast

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

req-fast - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

test/header.js

5

lib/req_stream.js

@@ -99,2 +99,3 @@ // Copyright 2014 Tjatse

}
var req = this.client.request(this.options, function (res) {

@@ -106,2 +107,3 @@ var status = res.statusCode;

this.redirects.push(nextTarget.valueOf());
// reset host

@@ -113,3 +115,4 @@ this.options.headers.host = nextTarget.host();

this.options.isIp = nextTarget.is('ip');
// CAUTION: abort previous request at first.
try{ req && req.abort(); req = null; }catch(err){ }
return this.next(this.request);

@@ -116,0 +119,0 @@ }else{

6

lib/req.js

@@ -33,5 +33,9 @@ // Copyright 2014 Tjatse

var called = false;
if(callback){
rs.on('error', function(error, response){
callback(error, response);
if(!called){
callback(error, response);
called = true;
}
});

@@ -38,0 +42,0 @@ var resp;

{
"name": "req-fast",
"version": "0.1.3",
"version": "0.1.4",
"description": "This module is designed to be the fast, lightweight way to fetch the web content(HTML stream).",
"main": "lib/req.js",
"scripts": {
"test": "./node_modules/.bin/mocha -R spec -t 10000"
"test": "./node_modules/.bin/mocha -R spec -t 20000"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -12,3 +12,3 @@ # req-fast

## Installation
```javascript
```
npm install req-fast

@@ -111,5 +111,12 @@ ```

## Tests
Most tests' requests are sent to [httpbin](http://httpbin.org), so if you wanna run the test, please make sure you can resolve the host(httpbin).
Run test:
```
npm test
```
## TODO
- [ ] More examples
- [ ] Write test cases
- [x] Write test cases
- [ ] Performance tests

@@ -116,0 +123,0 @@ - [ ] Fix typo bugs

@@ -7,3 +7,3 @@ var req = require('../'),

describe('basic request', function(){
describe.skip('from google', function(){
describe('from google', function(){
it('everything goes fine', function(done){

@@ -10,0 +10,0 @@ req('http://www.google.com', function(err, resp){

@@ -7,3 +7,3 @@ var req = require('../'),

describe('decoding content', function(){
describe.skip('from Chinese', function(){
describe('from Chinese', function(){
it('automatic', function(done){

@@ -10,0 +10,0 @@ req('http://news.163.com/14/1011/05/A88K45VJ0001121M.html', function(err, resp){

@@ -6,3 +6,3 @@ var req = require('../'),

describe.skip('cookies', function(){
describe('cookies', function(){
describe('were passed to server', function(){

@@ -9,0 +9,0 @@ it('should be detected', function(done){

@@ -7,3 +7,3 @@ var req = require('../'),

// all support methods: 'OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'TRACE', 'CONNECT'
describe.skip('request', function(){
describe('request', function(){
describe('through GET method', function(){

@@ -10,0 +10,0 @@ it('no matter dataType is', function(done){

@@ -6,3 +6,3 @@ var req = require('../'),

describe.skip('decompress encodings', function(){
describe('decompress encodings', function(){
describe('gzip', function(){

@@ -14,3 +14,3 @@ it('enabled(default)', function(done){

expect(resp.body).to.have.property('gzipped', true);
expect(resp.body).deep.have.property('headers.Accept-Encoding', 'gzip,deflate');
expect(resp.body).deep.have.property('headers.Accept-Encoding', 'gzip,deflate,sdch');
done();

@@ -38,3 +38,3 @@ });

expect(resp.body).to.have.property('deflated', true);
expect(resp.body).deep.have.property('headers.Accept-Encoding', 'gzip,deflate');
expect(resp.body).deep.have.property('headers.Accept-Encoding', 'gzip,deflate,sdch');
done();

@@ -41,0 +41,0 @@ });

@@ -7,3 +7,3 @@ var req = require('../'),

describe('handle', function(){
describe.skip('different status', function(){
describe('different status', function(){
[200, 201, 404].forEach(function(status){

@@ -10,0 +10,0 @@ it(status.toString(), function(done){

@@ -10,3 +10,3 @@ var req = require('../'),

describe('from google',function(){
it.skip('should create file and have HTML content',function(done){
it('should create file and have HTML content',function(done){
var pipeGoogleHome = function(){

@@ -23,2 +23,3 @@ req('http://www.google.com').pipe(fs.createWriteStream('google.html'));

expect(body).to.match(/^\s*</);
try{fs.unlink('google.html')}catch(err){}
done();

@@ -25,0 +26,0 @@ });

@@ -7,3 +7,3 @@ var req = require('../'),

describe('generate agent', function(){
describe.skip('randomize', function(){
describe('randomize', function(){
it('enabled(default)', function(done){

@@ -10,0 +10,0 @@ req('http://httpbin.org/user-agent', function(err, resp){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc