Skip to content

Instantly share code, notes, and snippets.

@cerebrl
Created November 5, 2013 06:11
Show Gist options
  • Save cerebrl/7314665 to your computer and use it in GitHub Desktop.
Save cerebrl/7314665 to your computer and use it in GitHub Desktop.
Q-IO HTTP Body Issue

I have two instances of Node.js running on my local environment, both with Express. One is the actual application client and the other is a mock API server, which is really nothing more than for me to ping against. The client has a basic model with CRUD object on it. Here's an example of the POST with the issue:

create: function (options) {

	return qHttp.request({
			"host": "127.0.0.1",
			"port": "8000"
			"method": "POST",
			"path": "/sessions",
			"body": ["It is me"]
		}).
		then(function (response) {
	
			return response.body.read();
		});
}

The other instance has a route that handles these requests simply. Example:

app.get('/sessions', function (req, res) {

	console.log(req.body);

	res.send(200);
});

When I run the method, the API server logs undefined, and I do have .bodyParser() in use with the Express, API server as well. Nothing other than the Array type works for the body. All other types silently stall; the request never goes out, never errors, nothing. For the life of me, I can't figure out what the deal is.

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