From 6b293cd266d5bdf87bfb24b1f76a361539541a88 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 28 Aug 2019 10:19:58 +0100 Subject: [PATCH] feat: support string data in pubsub.publish License: MIT Signed-off-by: Alan Shaw --- src/pubsub/publish.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pubsub/publish.js b/src/pubsub/publish.js index c13130e7f..a41c8fba0 100644 --- a/src/pubsub/publish.js +++ b/src/pubsub/publish.js @@ -6,10 +6,7 @@ const configure = require('../lib/configure') module.exports = configure(({ ky }) => { return async (topic, data, options) => { options = options || {} - - if (!Buffer.isBuffer(data)) { - throw new Error('data must be a Buffer') - } + data = Buffer.from(data) const searchParams = new URLSearchParams(options.searchParams) searchParams.set('arg', topic)