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 saying `new CloudEvent`). ## Expected ```js import { Receiver } from "cloudevents"; const event = Receiver.accept(headers, body); ``` ## Actual ```js import { Receiver } from "cloudevents"; const receiver = new Receiver(); const event = receiver.accept(headers, body); ``` ## Full Example For example, this should work in Express: ```js 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?
Activity
lib: change Receiver#accept() to be static Receiver.accept
lib: change Receiver#accept() to be static Receiver.accept (#271)