Success!

ChromeDriver accepts "Content-Length" in headers and does not accept 
"Content-length". So the following code works:

var data = '{ "desiredCapabilities": {}}',
    req = require('http').request(
        { host : '127.0.0.1', port : 33791, method : 'POST',
            path : '/session', headers : {
                'Content-Type' : 'application/json;charset=UTF-8',
                'Content-Length' : data.length
            }
        },
        function (res) {
            console.log('DEBUG STATUS: ' + res.statusCode);
            console.log('DEBUG HEADERS: ' + JSON.stringify(res.headers));
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                console.log(chunk);
            });
        }
    );
req.on('error', function(e) {
    console.log('problem with request: ' + e.message);
});
req.end(data);

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to