Skip to content
This repository

assert.response. second request after response #155

Open
zxcabs opened this Issue · 8 comments

5 participants

Evgeny Reznichenko Lenin Jon Keating nmcclay Zenedith
Evgeny Reznichenko

node v0.6.1
expresso v0.9.2

Hi,
How i can do second request using data from first response?

For example, on expresso v0.8.1, i can do this as:

assert.response(server, {
      url: '/',
      method: 'GET'
    }, {
      body: 'Hello World\n',
      status: 200,
      headers: {'Content-Type': 'text/plain'}
   }, function (res) {
      //now i can use res for second request
     assert.response(server, { url: '/foo', data: res.body }, ....); 
});

But, on expresso v0.9.2 this code drop error:

uncaught undefined: Error: connect ECONNREFUSED
at errnoException (net.js:614:11)
at Object.afterConnect [as oncomplete] (net.js:605:18)

So, how can i do it?

Lenin

Yes, this problem came after upgrading to node 0.6.1, it wasn't there before that. The same version was running fine with node 0.4.2.

Evgeny Reznichenko

And so, what can me do? Return to node v0.4.x or waiting fix?

Jon Keating

Ant idea when expresso will support node 0.6?

nmcclay

I'm adding a plus one to this, I really would like to be able to write more than one assert.response for a given test.

Zenedith

Any news?

Jon Keating

I would say, switch to mocha... that is what I did.

There is no assert.response in mocha, but you can include a http library that will do the same thing. I can send you a gist if want to see how I did it.

Zenedith

Thank you for your advice - I will be grateful for gist.

Zenedith

That's my solution - pretty fast switching!
https://gist.github.com/3024952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.