Question

I'm using nimble.js in my app and mocha + chai for testing, but yesterday I found them to be possibly conflicting.

Basically, when I do a particular http request in my browser, I get

Unauthorized.

which is the correct response.

But using node's http module to do a http request using the same url, I get

not found

Which is confusing me.

I know the http request got the right url because I see it in the server console, even copy pasted it in my browser to be sure.

Additionally, I traced the code to the nimble.parallel function.

I have something like this:

// var _ = require('nimble');
_.parallel(
  [
    fetch_account(options)
  , fetch_invoice(options)
  , fetch_site(options)
  , fetch_account_stats(options)
  ]
, render(res, subdomain)
);
// each of the function above returns another function, no simple API gotcha here

In the browser case, an error was correctly identified in a fetch function, then also in the render case.

In the mocha case, an error was correctly identified in a fetch function, but render was not executed. Hence, mocha must've did its own res.render("not found");

Any ideas?

Was it helpful?

Solution

I'm a f*cking idiot.

Forgot to set accept header.

But I'm still confused why I traced to same code but got different behavior.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top