@@ -36,7 +36,7 @@ const http_connect_path = path.join(tmp_connect, http_connect_filename);
3636//content of connect file, will be written to a file in before()
3737const http_connect = {
3838 agent_request_object : { "host" : "localhost" , "port" : 9998 , "timeout" : 1500 } ,
39- request_options_object : { "auth" : "amit:passw" , "timeout" : 1500 } ,
39+ request_options_object : { "auth" : "amit:passw" , "timeout" : 1500 , "path" : "/default" } ,
4040 notification_protocol : 'http' ,
4141 name : 'http_notif'
4242} ;
@@ -54,6 +54,7 @@ let expected_bucket;
5454let expected_event_name ;
5555let expected_key ;
5656let expected_eTag ;
57+ let expected_url ;
5758
5859// eslint-disable-next-line max-lines-per-function
5960mocha . describe ( 'notifications' , function ( ) {
@@ -91,6 +92,7 @@ mocha.describe('notifications', function() {
9192 const notif = JSON . parse ( input . toString ( ) ) ;
9293
9394 if ( notif !== "test notification" ) {
95+ assert . strictEqual ( req . url , expected_url ) ;
9496 assert . strictEqual ( notif . Records [ 0 ] . s3 . bucket . name , expected_bucket , 'wrong bucket name in notification' ) ;
9597 assert . strictEqual ( notif . Records [ 0 ] . eventName , expected_event_name , 'wrong event name in notification' ) ;
9698 assert . strictEqual ( notif . Records [ 0 ] . s3 . object . key , expected_key , 'wrong key in notification' ) ;
@@ -224,18 +226,47 @@ mocha.describe('notifications', function() {
224226 } ) ;
225227 } ) ;
226228
229+ mocha . it ( 'override connection' , async ( ) => {
230+ await s3 . putBucketNotificationConfiguration ( {
231+ Bucket : bucket ,
232+ NotificationConfiguration : {
233+ TopicConfigurations : [ {
234+ "Id" : "system_test_http_no_event_override" ,
235+ "TopicArn" : http_connect_filename + "?" + JSON . stringify ( {
236+ request_options_object : { path : "/override" }
237+ } ) ,
238+ } ] ,
239+ } ,
240+ } ) ;
241+
242+ const res = await s3 . putObject ( {
243+ Bucket : bucket ,
244+ Key : 'f1' ,
245+ Body : 'this is the body' ,
246+ } ) ;
247+
248+ await notify_await_result ( {
249+ bucket_name : bucket ,
250+ event_name : 'ObjectCreated:Put' ,
251+ key : "f1" ,
252+ etag : res . ETag ,
253+ url : "/override"
254+ } ) ;
255+ } ) ;
256+
227257 } ) ;
228258
229259} ) ;
230260
231261const step_wait = 100 ;
232- async function notify_await_result ( { bucket_name, event_name, etag, key, timeout = undefined } ) {
262+ async function notify_await_result ( { bucket_name, event_name, etag, key, url = "/default" , timeout = undefined } ) {
233263
234264 //remember expected result here so server could compare it to actual result later
235265 expected_bucket = bucket_name ;
236266 expected_event_name = event_name ;
237267 expected_eTag = etag ;
238268 expected_key = key ;
269+ expected_url = url ;
239270 server_done = false ;
240271
241272 //busy-sync wait for server
0 commit comments