Skip to content

About

add charset support for node's superagent

Resources

Stars

81 stars

Watchers

6 watching

Forks

Latest commit

 

History

71 Commits

Folders and files

Repository files navigation

superagent-charset

add charset support for node's superagent

Build Status Coverage Status npm version npm downloads npm license Greenkeeper badge

Install

$ npm i superagent-charset --save

API

install

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

this will add request.Request.prototype.charset

charset

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

const should = require('should')
const request = require('superagent')
require('superagent-charset')(request) // install charset

describe('Basic Test', function() {
  it('it works', function(done) {
    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

About

add charset support for node's superagent

Resources

Stars

81 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages