add charset support for node's superagent
JavaScript
Latest commit 1cf4e6e Jun 25, 2016 @magicdawn deps: update dev deps

README.md

superagent-charset

add charset support for node's superagent

Build Status Coverage Status npm version npm downloads npm license

Install

$ npm i superagent-charset --save

API

install

const charset = require('superagent-charset');
const request = require('superagent');
charset(request);

this will add request.Request.prototype.charset

charset

.charset(encoding) , will passed to iconv-lite

const charset = require('../');
const should = require('should');

describe('Basic Test', function() {
  it('it works', function(done) {
    // install charset;
    const request = require('superagent');
    charset(request);

    request.get('http://www.sohu.com/')
      .charset('gbk')
      .end((err, res) => {
        res.text.should.match(/搜狐/);
        done(err);
      });
  });
});

License

the MIT License, http://magicdawn.mit-license.org