Skip to content

Commit 2ce6c05

Browse files
authored
feat: support binary data in cloudevents (#112)
Depends on: cloudevents/sdk-javascript#468 Fixes: #64 Signed-off-by: Lance Ball <lball@redhat.com>
1 parent 2fbe601 commit 2ce6c05

File tree

9 files changed

+595
-5106
lines changed

9 files changed

+595
-5106
lines changed

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ function start(func, options) {
4343
});
4444
payload.on('error', done);
4545
});
46+
47+
server.addContentTypeParser('*', { parseAs: 'buffer' }, function(req, body, done) {
48+
try {
49+
done(null, body);
50+
} catch (err) {
51+
err.statusCode = 400;
52+
done(err, undefined);
53+
}
54+
});
4655

4756
// Initialize the invocation context
4857
// This is passed as a parameter to the function when it's invoked

0 commit comments

Comments
 (0)