@@ -388,13 +388,26 @@ def expired_unix_timestamp(seconds_ago = 600)
388
388
389
389
it "successfully validates using a custom auth plugin" do
390
390
payload = { } . to_json
391
- headers = { "Authorization" => "Bearer octoawesome-shared-secret" }
392
- response = make_request ( :post , "/webhooks/with_custom_auth_plugin" , payload , headers )
391
+ headers = { "Authorization" => "Bearer octoawesome-shared-secret" , "Content-Type" => "application/json" }
392
+ response = make_request ( :post , "/webhooks/with_custom_auth_plugin?foo=bar&bar=baz " , payload , headers )
393
393
394
394
expect_response ( response , Net ::HTTPSuccess )
395
395
body = parse_json_response ( response )
396
396
expect ( body [ "status" ] ) . to eq ( "test_success" )
397
397
expect ( body [ "handler" ] ) . to eq ( "TestHandler" )
398
+ expect ( body [ "payload_received" ] ) . to eq ( { } )
399
+ expect ( body [ "env_received" ] ) . to have_key ( "REQUEST_METHOD" )
400
+
401
+ env = body [ "env_received" ]
402
+ expect ( env [ "hooks.request_id" ] ) . to be_a ( String )
403
+ expect ( env [ "hooks.handler" ] ) . to eq ( "TestHandler" )
404
+ expect ( env [ "hooks.endpoint_config" ] ) . to be_a ( Hash )
405
+ expect ( env [ "hooks.start_time" ] ) . to be_a ( String )
406
+ expect ( env [ "hooks.full_path" ] ) . to eq ( "/webhooks/with_custom_auth_plugin" )
407
+ expect ( env [ "HTTP_AUTHORIZATION" ] ) . to eq ( "Bearer octoawesome-shared-secret" )
408
+ expect ( env [ "CONTENT_TYPE" ] ) . to eq ( "application/json" )
409
+ expect ( env [ "CONTENT_LENGTH" ] ) . to eq ( "2" ) # length of "{}"
410
+ expect ( env [ "QUERY_STRING" ] ) . to eq ( "foo=bar&bar=baz" )
398
411
end
399
412
400
413
it "rejects requests with invalid credentials using custom auth plugin" do
0 commit comments