Hello, I originally posted this in a supertest issue and was asked to repost here.
I am needing to write tests for Adobe AMF requests and responses which are both binary. The mime type is "application/x-amf". I am finding that various sequences of characters are being garbled and I believe this to be because of the utf8 interpretation within JS strings.
I think a great solution would be to allow us to send() a node Buffer class which is made for binary data and perhaps the same in the response.
I notice there is an open issue (Add Buffer support) in here which would solve my problem. There is also some suggested code to add support however, I did a quick patch to try this but it falls over elsewhere so it's not quite as simple as that.
I would be most grateful for any solution which will allow convenient support for sending/receiving binary data...many thanks.
Alright. Follow the other issue #80 for updates.
+1.
Not a superagent fix, but here is a workaround I am using in my tests:
var req = http.request({
hostname: '127.0.0.1',
port: server.address().port,
method: 'POST',
path: '/test'
}, function(res) {
assert(res.statusCode == 200);
done();
})
req.write(buffer);
req.end();
Most helpful comment
+1.
Not a superagent fix, but here is a workaround I am using in my tests: