mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
refactor(core): refine webhook log payload (#3973)
rename log payload field `json` -> `hookRequest.body`
This commit is contained in:
parent
032b7f9d07
commit
c54b8bb629
2 changed files with 8 additions and 5 deletions
|
@ -100,10 +100,13 @@ describe('triggerInteractionHooks()', () => {
|
|||
expect(calledPayload).toHaveProperty('key', 'TriggerHook.' + HookEvent.PostSignIn);
|
||||
expect(calledPayload).toHaveProperty('payload.result', LogResult.Success);
|
||||
expect(calledPayload).toHaveProperty('payload.hookId', 'foo');
|
||||
expect(calledPayload).toHaveProperty('payload.json.event', HookEvent.PostSignIn);
|
||||
expect(calledPayload).toHaveProperty('payload.json.interactionEvent', InteractionEvent.SignIn);
|
||||
expect(calledPayload).toHaveProperty('payload.json.hookId', 'foo');
|
||||
expect(calledPayload).toHaveProperty('payload.json.userId', '123');
|
||||
expect(calledPayload).toHaveProperty('payload.hookRequest.body.event', HookEvent.PostSignIn);
|
||||
expect(calledPayload).toHaveProperty(
|
||||
'payload.hookRequest.body.interactionEvent',
|
||||
InteractionEvent.SignIn
|
||||
);
|
||||
expect(calledPayload).toHaveProperty('payload.hookRequest.body.hookId', 'foo');
|
||||
expect(calledPayload).toHaveProperty('payload.hookRequest.body.userId', '123');
|
||||
expect(calledPayload).toHaveProperty('payload.response.statusCode', 200);
|
||||
expect(calledPayload).toHaveProperty('payload.response.body.message', 'ok');
|
||||
jest.useRealTimers();
|
||||
|
|
|
@ -95,7 +95,7 @@ export const createHookLibrary = (queries: Queries) => {
|
|||
const json: HookEventPayload = { hookId: id, ...payload };
|
||||
const logEntry = new LogEntry(`TriggerHook.${hookEvent}`);
|
||||
|
||||
logEntry.append({ json, hookId: id });
|
||||
logEntry.append({ hookId: id, hookRequest: { body: json } });
|
||||
|
||||
// Trigger web hook and log response
|
||||
await sendWebhookRequest({
|
||||
|
|
Loading…
Add table
Reference in a new issue