0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

refactor(core): remove message id from hook request headers (#3979)

This commit is contained in:
Xiao Yijun 2023-06-06 13:20:05 +08:00 committed by GitHub
parent c54b8bb629
commit c5770107a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 11 deletions

View file

@ -14,7 +14,6 @@ Provide new features for webhooks
- Allow to enable/disable a webhook
- Track recent execution status of a webhook
- Support multi-events for a webhook
- Add a unique message id for each webhook request
## Updates
@ -22,7 +21,6 @@ Provide new features for webhooks
- core: change the `user-agent` value from `Logto (https://logto.io)` to `Logto (https://logto.io/)` in the webhook request headers
- core: deprecate `event` field in all hook-related APIs, use `events` instead
- core: deprecate `retries` field in the `HookConfig` for all hook-related APIs, now it will fallback to `3` if not specified and will be removed in the future
- core: add a unique message id for each webhook request
- core: add new APIs for webhook management
- `GET /api/hooks/:id/recent-logs` to retrieve recent execution logs(24h) of a webhook
- `POST /api/hooks/:id/test` to test a webhook

View file

@ -16,12 +16,6 @@ mockEsm('#src/utils/sign.js', () => ({
sign: () => mockSignature,
}));
const mockNanoId = 'mockNanoidId';
await mockEsmWithActual('@logto/shared', () => ({
buildIdGenerator: jest.fn().mockReturnValue(mockNanoId),
generateStandardId: jest.fn().mockReturnValue(mockNanoId),
}));
const { generateHookTestPayload, sendWebhookRequest } = await import('./utils.js');
describe('sendWebhookRequest', () => {
@ -47,7 +41,6 @@ describe('sendWebhookRequest', () => {
'user-agent': 'Logto (https://logto.io/)',
foo: 'bar',
'logto-signature-sha-256': mockSignature,
'logto-message-id': mockNanoId,
},
json: testPayload,
retry: { limit: 3 },

View file

@ -4,7 +4,6 @@ import {
ApplicationType,
type HookConfig,
} from '@logto/schemas';
import { generateStandardId } from '@logto/shared';
import { conditional, trySafe } from '@silverhand/essentials';
import { got, type Response } from 'got';
@ -34,7 +33,6 @@ export const sendWebhookRequest = async ({
'user-agent': 'Logto (https://logto.io/)',
...headers,
...conditional(signingKey && { 'logto-signature-sha-256': sign(signingKey, payload) }),
'logto-message-id': generateStandardId(),
},
json: payload,
retry: { limit: retries ?? 3 },