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

Already on GitHub? Sign in to your account

browser.post json object #64

Open
kof opened this Issue Sep 14, 2011 · 0 comments

Comments

Projects
None yet
1 participant

kof commented Sep 14, 2011

Hi I have 1 issue and 1 enhancement here :)

Issue:

If I using

data = {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({bla: ''blubb'})
}

and browser.post(data, cb)

there is an error in connect bodyParser at the point where body will be JSON parsed.

I have debugged - the string is broken, it is shotter then the original string should be.

I investigated further:

headers['Content-Length'] = options.body.length;

It seems that content-length is wrong calculated here ... (I have a large json string hopefully you can reproduce it with any one)

Removing content-length from tobi solves the problem.

Enhancement

I don't want to setup header every time I want post a json object. It can be detected automatically.

I am trying to use tobi for integration tests of the api.

Can we fix this fast? I can provide you a patch.

Best,
Oleg

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