Commit fb55555
Return null event_source_url when scheme is missing
Summary:
Update `constructEventSourceUrl()` to return null when `$data->scheme` is empty, instead of defaulting to `"http"`. If scheme is null/empty, it means the adaptor was not called or no scheme data is available — defaulting to `"http"` would produce a potentially incorrect URL.
The adaptor (`RequestContextAdaptor::extract()`) already guarantees a non-null scheme (`"http"` or `"https"`) when server context is available. The fallback to `"http"` belongs in the adaptor, not in the URL construction logic.
Changes:
- `constructEventSourceUrl()`: Add `empty($data->scheme)` to the null guard
- `constructEventSourceUrl()`: Use `$data->scheme` directly instead of `$data->scheme ?? "http"`
- `EventSourceUrlTest.php`: Update tests that previously expected `"http://..."` when scheme was null to expect null instead
Reviewed By: jyou23github
Differential Revision: D105385176
fbshipit-source-id: 69c28d7c1a3d0dde08c54796d70480881cc97bc91 parent 0b563cb commit fb55555
2 files changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| |||
0 commit comments