-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Description
Like Ruby and some other SDKs, it should be 1 line to extract a CloudEvent JSON object from a HTTP request.
- 1 line/function for HTTP -> CloudEvent object
- No constructors needed. No
new(unless we're sayingnew CloudEvent).
Expected
import { Receiver } from "cloudevents";
const event = Receiver.accept(headers, body);Actual
import { Receiver } from "cloudevents";
const receiver = new Receiver();
const event = receiver.accept(headers, body);Full Example
For example, this should work in Express:
import { Receiver } from "cloudevents";
const myFunction = (req, res) => {
const event = Receiver.accept(req.headers, req.body);
console.log(event.type);
};This should be updated in the README (currently CloudEvent is unused).
I don't know what the receiver object is really for. Maybe historical. Should be pretty lightweight, right?
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels