Skip to content

axios doesn’t work with fakeweb #27

Description

@macabeus

Using axios version 0.16.0 and fakeweb version 1.1.0, fakeweb made axios raises an exception when access the URL, but the same URL works when using another lib, like prequest.

googleSpy = fakeweb.registerUri({uri: 'http://www.google.com/', body: 'Hello' })
// returns: { used: false, useCount: 0 }

prequest({url: 'http://www.google.com/' }).then(console.log)
// returns: Hello

axios.post('http://www.google.com/').catch(err => console.log(err))
/* returns:
TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be one of type Array, Buffer, or Uint8Array
    at Function.concat (buffer.js:465:13)
    at EventEmitter.handleStreamEnd (/Users/macabeus/Desktop/pagarme-core/gateway/node_modules/axios/lib/adapters/http.js:180:37)
    at EventEmitter.emit (events.js:180:13)
    at EventEmitter.emit (domain.js:440:23)
    at EventEmitter.thisRequest.end (node_modules/node-fakeweb/src/lib/overrides.js:67:18)
    at RedirectableRequest.end (node_modules/follow-redirects/index.js:128:23)
    at dispatchHttpRequest (node_modules/axios/lib/adapters/http.js:223:11)
    at new Promise (<anonymous>)
    at httpAdapter (node_modules/axios/lib/adapters/http.js:19:10)
    at dispatchRequest (node_modules/axios/lib/core/dispatchRequest.js:52:10)
*/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions