File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -996,20 +996,21 @@ describe("Replicate client", () => {
996
996
} ) ;
997
997
998
998
test ( "Can be used to validate webhook" , async ( ) => {
999
- const secret = "whsec_5WbX5kEWLlfzsGNjH64I8lOOqUB6e8FH" ;
1000
-
999
+ // Test case from https://github.com/svix/svix-webhooks/blob/b41728cd98a7e7004a6407a623f43977b82fcba4/javascript/src/webhook.test.ts#L190-L200
1001
1000
const request = new Request ( "http://test.host/webhook" , {
1002
1001
method : "POST" ,
1003
1002
headers : {
1004
1003
"Content-Type" : "application/json" ,
1005
- "Webhook-ID" : "123 " ,
1006
- "Webhook-Timestamp" : "1707329251 " ,
1004
+ "Webhook-ID" : "msg_p5jXN8AQM9LWM0D4loKWxJek " ,
1005
+ "Webhook-Timestamp" : "1614265330 " ,
1007
1006
"Webhook-Signature" :
1008
- "v1,nSIlB+PQG9cA4fNl6ec/aOmwxZktHIR5L0ymA5/Cm3E =" ,
1007
+ "v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE =" ,
1009
1008
} ,
1010
- body : `{event:"output",data:"Hello, world!" }` ,
1009
+ body : `{"test": 2432232314 }` ,
1011
1010
} ) ;
1012
1011
1012
+ const secret = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw" ;
1013
+
1013
1014
const isValid = await validateWebhook ( request , secret ) ;
1014
1015
expect ( isValid ) . toBe ( true ) ;
1015
1016
} ) ;
You can’t perform that action at this time.
0 commit comments