Sunday, 29 September 2013

How to pipe POST requests

How to pipe POST requests

I'm a bit confused about how to pipe some data.
I've got some pipes working and chained such that I not have an output
stream containing the data I want to input to a request POST
var options = {
host: 'localhost',
port: 8529,
path: '/_api/cursor',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
}
}
var req = http.request(options);
I would normally just action 'mystreams2.pipe(req)' but how do I set the
'data.length' value ?
(I'm using the streams2 interface not the old stream format)

No comments:

Post a Comment