You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is no way the header's are defaulted. Guess it would be nice that there is a way to set some headers that are anyway expected by many of the server side code (e.g. express.js) like already done at https://github.com/LearnBoost/tobi/blob/master/lib/browser.js#L158. The other day tobi simulated POST request couldn't find req.body in the express.js middleware as headers['Content-type'] = 'application/json'; was missing.
browser.get('/login', { headers: { ... }}, function(res, $){ etc. how would you expect them to be defaulted? you want it to guess that it's json? not sure I get what you mean
It's easy enough in an explicit browser.get or browser.post to set headers, but I can't set headers in the GET that occurs on a browser.click, for instance.
I'd like to be able to default the browser to always send Accept: text/html (unless I explicitly override it in an individual GET) but right now I can't.
Similarly, you can't set the headers for a POST that happens as the result of a $('form').submit(). I'm using tobi with a system that creates a separate set of database tables namespaced by the virtual host. In testing on localhost, I set the host header to 'test' for each call to take advantage of this and segregate the test data. Works, except for the POST on submit(). What's the right solution here? Carry the host header in a browser.get/post/etc on to any subsequent requests?
Activity
tj commentedon Jun 7, 2011
browser.get('/login', { headers: { ... }}, function(res, $){etc. how would you expect them to be defaulted? you want it to guess that it's json? not sure I get what you meantastapod commentedon Jun 14, 2011
It's easy enough in an explicit
browser.getorbrowser.postto set headers, but I can't set headers in the GET that occurs on abrowser.click, for instance.I'd like to be able to default the browser to always send
Accept: text/html(unless I explicitly override it in an individual GET) but right now I can't.hudgins commentedon Jan 5, 2012
Similarly, you can't set the headers for a POST that happens as the result of a $('form').submit(). I'm using tobi with a system that creates a separate set of database tables namespaced by the virtual host. In testing on localhost, I set the host header to 'test' for each call to take advantage of this and segregate the test data. Works, except for the POST on submit(). What's the right solution here? Carry the host header in a browser.get/post/etc on to any subsequent requests?