Implement a new layer of abstraction for the request API, more focused on the binary and streams treatment:
var options = {
headers : {},
useCookies : false,
withCredentials : true
};
corbel.request
.get('/adasdad', options)
.asBlob();
corbel.request
.get('/mysong.binary.blob', options)
.asFile('audio/mp3');
//Returns promise
//vs
corbel.request.send({
method: 'GET',
url: url
});
//Returns promise
//vs
request.send({
method: 'GET',
url: url,
success: function(data, status, httpResponse) {
expect(data).to.be.a('object');
expect(status).to.be.a('number');
expect(httpResponse).to.be.an('object');
done();
}
});
corbel.request.put('/asdasd', body, options);
corbel.request.post('/asdasd', body, options);
binaryReadStream
.pipe(corbel.request.post('/mifile.mp3').asFile('audio/mp3'));
corbel.request
.post('/adasdad', binaryBlob, options)
.asFile('audio/mp3');
corbel.request.send({
method: 'POST',
url: url,
contentType : 'application/json',
data: testText
})
corbel.request.del('/asdasd', options);
Implement a new layer of abstraction for the request API, more focused on the binary and streams treatment: