New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This feature hasn't been implmented yet. Please submit an Issue or Pull Request on Github. #13

Closed
chrisabrams opened this Issue Jul 14, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@chrisabrams
Copy link

chrisabrams commented Jul 14, 2016

This error is very vague; I have no idea what feature is not implemented. :O

For reference, here is what I tried doing:

var xhrMock = require('xhr-mock')

xhrMock.setup()

xhrMock.post('http://localhost:4567/foo', function(req, res) {
  return res
    .status(201)
    .header('Content-Type', 'application/json')
    .body(JSON.stringify({
      created: true
    }))
})

var send = return new Promise( (resolve, reject) => {

  var request = new XMLHttpRequest()

  request.open('POST', 'http://localhost:4567/foo', true)

  request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')

  request.addEventListener('load', function onLoad(res) {
    console.log('res', res)
    resolve(JSON.parse(res.responseText))
  })

  request.addEventListener('error', function onXMLHttpRequestError(e) {
    reject(e)
  })

  request.send(pkg)

})

send()

@chrisabrams chrisabrams changed the title test.js:5295 Error: This feature hasn't been implmented yet. Please submit an Issue or Pull Request on Github. This feature hasn't been implmented yet. Please submit an Issue or Pull Request on Github. Jul 14, 2016

@chrisabrams

This comment has been minimized.

Copy link

chrisabrams commented Jul 14, 2016

It would appear that addEventListener is not supported:

MockXMLHttpRequest.prototype.addEventListener = function(event, listener) {

@jameslnewell

This comment has been minimized.

Copy link
Owner

jameslnewell commented Jul 17, 2016

Thanks for reporting!

I haven't used (a library that uses) addEventListener yet and haven't found the time/need to implement it yet. Would you be able to submit a PR that improves the error messaging, or that implements the feature according to spec?

@jameslnewell

This comment has been minimized.

Copy link
Owner

jameslnewell commented Jan 4, 2017

This was recently implemented in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment