@@ -438,8 +438,17 @@ impl EventObserver {
438
438
} ;
439
439
440
440
for ( id, url, payload, timeout_ms) in pending_payloads {
441
+ let full_url = Url :: parse ( url. as_str ( ) )
442
+ . unwrap_or_else ( |_| panic ! ( "Event dispatcher: unable to parse {url} as a URL" ) ) ;
443
+ let endport_url = Url :: parse ( format ! ( "http://{}" , & self . endpoint) . as_str ( ) )
444
+ . unwrap_or_else ( |_| {
445
+ panic ! (
446
+ "Event dispatcher: unable to parse {} as a URL" ,
447
+ & self . endpoint
448
+ )
449
+ } ) ;
441
450
// If the URL is not the same as the endpoint, skip it
442
- if !url . starts_with ( & self . endpoint ) {
451
+ if full_url . origin ( ) != endport_url . origin ( ) {
443
452
continue ;
444
453
}
445
454
let timeout = Duration :: from_millis ( timeout_ms) ;
@@ -2049,7 +2058,7 @@ mod test {
2049
2058
let db_path = dir. path ( ) . join ( "event_observers.sqlite" ) ;
2050
2059
let db_path_str = db_path. to_str ( ) . unwrap ( ) ;
2051
2060
let mut server = mockito:: Server :: new ( ) ;
2052
- let endpoint = server. url ( ) . to_string ( ) ;
2061
+ let endpoint = server. host_with_port ( ) ;
2053
2062
let timeout = Duration :: from_secs ( 5 ) ;
2054
2063
let observer =
2055
2064
EventObserver :: new ( Some ( dir. path ( ) . to_path_buf ( ) ) , endpoint. clone ( ) , timeout) ;
@@ -2093,7 +2102,7 @@ mod test {
2093
2102
let db_path_str = db_path. to_str ( ) . unwrap ( ) ;
2094
2103
2095
2104
let mut server = mockito:: Server :: new ( ) ;
2096
- let endpoint = server. url ( ) . to_string ( ) ;
2105
+ let endpoint = server. host_with_port ( ) ;
2097
2106
let timeout = Duration :: from_secs ( 5 ) ;
2098
2107
let observer =
2099
2108
EventObserver :: new ( Some ( dir. path ( ) . to_path_buf ( ) ) , endpoint. clone ( ) , timeout) ;
0 commit comments