Skip to content

Instantly share code, notes, and snippets.

@billjohnston
Created March 2, 2021 19:16
Show Gist options
  • Save billjohnston/72881acc2a6426ab0a045d58d1b8efff to your computer and use it in GitHub Desktop.
Save billjohnston/72881acc2a6426ab0a045d58d1b8efff to your computer and use it in GitHub Desktop.
webhookrelay debug
curl https://1zfeu833kgom8kvdororgg.hooks.webhookrelay.com -X POST
curl https://my.webhookrelay.com/v1/webhooks/0d970bf0-9c84-440a-8013-6835287e6c7b -X POST
yarn run v1.22.10
$ NODE_PATH=./src ./node_modules/.bin/jest e2e
{"message":"subscribed to webhook stream successfully","level":"info"}
console.log
{
type: 'status',
status: 'subscribed',
message: 'subscribed to buckets: 0d970bf0-9c84-440a-8013-6835287e6c7b'
}
at WebhookRelayClient._handler (src/e2eTest.test.ts:25:21)
{"message":"manual disconnect","level":"info"}
RUNS src/e2eTest.test.ts
import { WebhookRelayClient } from 'webhookrelay-ws-client';
const relayKey = 'blahblahblah';
const relaySecret = 'blahblahblah';
let client: WebhookRelayClient;
afterAll(() => {
if (client) {
client.disconnect();
}
});
test(
'e2e',
async () => {
const webhook = () =>
new Promise((resolve, reject) => {
client = new WebhookRelayClient(
relayKey,
relaySecret,
['0d970bf0-9c84-440a-8013-6835287e6c7b'],
(data) => {
const parsed = JSON.parse(data);
console.log(parsed);
if (parsed.status !== 'subscribed') {
resolve(parsed);
}
client.disconnect();
}
);
client.connect();
});
const res = await webhook();
expect(res).toEqual({});
},
15 * 60 * 1000
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment