From 21c3cf6eb0e334b33d75b518dc4c70e052a2e4d8 Mon Sep 17 00:00:00 2001 From: kahirokunn Date: Sun, 16 Aug 2026 22:31:51 +0900 Subject: [PATCH] docs: return the transport promise from the custom emitter examples Signed-off-by: kahirokunn --- API_TRANSITION_GUIDE.md | 10 ++++++---- README.md | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/API_TRANSITION_GUIDE.md b/API_TRANSITION_GUIDE.md index 4370a732..f968e902 100644 --- a/API_TRANSITION_GUIDE.md +++ b/API_TRANSITION_GUIDE.md @@ -59,8 +59,9 @@ const { emitterFor, Mode } = require("cloudevents"); function sendWithAxios(message) { // Do what you need with the message headers // and body in this function, then send the - // event - axios({ + // event. Return the promise so that `await emit(event)` + // waits for the send and rejects if it fails. + return axios({ method: 'post', url: '...', data: message.body, @@ -81,8 +82,9 @@ const { emitterFor, Mode, CloudEvent, Emitter } = require("cloudevents"); function sendWithAxios(message) { // Do what you need with the message headers // and body in this function, then send the - // event - axios({ + // event. Return the promise so that `await emit(event)` + // waits for the send and rejects if it fails. + return axios({ method: "post", url: "...", data: message.body, diff --git a/README.md b/README.md index b40b8de3..abac1560 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,9 @@ const { emitterFor, Mode, CloudEvent } = require("cloudevents"); function sendWithAxios(message) { // Do what you need with the message headers // and body in this function, then send the - // event - axios({ + // event. Return the promise so that `await emit(event)` + // waits for the send and rejects if it fails. + return axios({ method: "post", url: "...", data: message.body,