-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[expo-dev-launcher] Add missing Network.requestWillBeSentExtraInfo
event
#21965
Conversation
@@ -80,11 +80,25 @@ class DevLauncherNetworkLogger private constructor() { | |||
)) | |||
} | |||
} | |||
val data = JSONObject(mapOf( | |||
var data = JSONObject(mapOf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like changing from val to var if not needed. Just create a new variable with a meaningful name instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, do you want me to change the others as well? I copied this from:
Lines 130 to 135 in 974bd5c
params = mapOf( | |
"requestId" to requestId, | |
"timestamp" to now, | |
"encodedDataLength" to (response.body()?.contentLength() ?: 0), | |
) | |
data = JSONObject(mapOf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a good idea. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/expo-dev-launcher/ios/Network/EXDevLauncherNetworkLogger.swift
Outdated
Show resolved
Hide resolved
...-launcher/android/src/main/java/expo/modules/devlauncher/network/DevLauncherNetworkLogger.kt
Outdated
Show resolved
Hide resolved
...-launcher/android/src/main/java/expo/modules/devlauncher/network/DevLauncherNetworkLogger.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
/** | ||
* Emits CDP `Network.responseReceived` and `Network.loadingFinished` events | ||
*/ | ||
fun emitNetworkResponse(request: Request, requestId: String, response: Response) { | ||
val now = BigDecimal(System.currentTimeMillis() / 1000.0).setScale(3, RoundingMode.CEILING) | ||
var params = mapOf( | ||
val responseReceivedParams = mapOf( | ||
"requestId" to requestId, | ||
"loaderId" to "", | ||
"hasExtraInfo" to false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think we should set the hasExtraInfo
as true when we send the Network.requestWillBeSentExtraInfo
?
and also redirectHasExtraInfo
maybe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right about the redirectHasExtraInfo
:
But I don't think we have to enable the hasExtraInfo
on Network.responseReceived
, because that refers to the Network.responseReceivedExtraInfo
.
So far, this change is only required because of the visual "Network.requestWillBeSentExtraInfo
event". Luckily, we do have an option to disable it for responses (this hasExtraInfo
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense and nice explanation! thanks
fc4e209
to
4e7fa54
Compare
Co-authored-by: Kudo Chien <kudo@expo.dev>
…ve a redirect response
4e7fa54
to
fc4597b
Compare
…event (#21965) # Why This fixes the last two remaining "weird debug information" in chrome devtools. 1. The request headers are marked as "⚠️ Provisional headers shown" 2. The `Timing` column is stuck on "Pending" instead of showing the actual request time. Page | Screenshot --- | --- Overview | <img src="https://user-images.githubusercontent.com/1203991/229575879-201d2b47-ff02-4512-adc3-72716fad71f8.png"> Headers tab | <img src="https://user-images.githubusercontent.com/1203991/229575999-b57c6428-a754-4e69-910e-a1cd76c9b761.png"> Timing tab | <img width="1030" alt="image" src="https://user-images.githubusercontent.com/1203991/229576107-d08d1f65-9203-4e7e-bf4d-73b42bbbbc8f.png"> # How The two missing pieces of information are sent in the [`Network.requestWillBeSentExtraInfo`](https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSentExtraInfo) event, under `headers` and `connectTiming.requestTime`. > I don't think we can actually get the `connectionStart`/`connectionEnd` timing, [as described here](https://developer.apple.com/documentation/foundation/nsurlsessiontasktransactionmetrics#3162615). Instead of fetching that value, we just skip it and let chrome devtools only show the actual response time. # Test Plan - Make a request `fetch('https://httpbin.org/anything')` - Check the network tab - Should NOT show `⚠️ Provisional headers are shown` - Should NOT show `Pending` under `Timing` # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
…event (#21965) # Why This fixes the last two remaining "weird debug information" in chrome devtools. 1. The request headers are marked as "⚠️ Provisional headers shown" 2. The `Timing` column is stuck on "Pending" instead of showing the actual request time. Page | Screenshot --- | --- Overview | <img src="https://user-images.githubusercontent.com/1203991/229575879-201d2b47-ff02-4512-adc3-72716fad71f8.png"> Headers tab | <img src="https://user-images.githubusercontent.com/1203991/229575999-b57c6428-a754-4e69-910e-a1cd76c9b761.png"> Timing tab | <img width="1030" alt="image" src="https://user-images.githubusercontent.com/1203991/229576107-d08d1f65-9203-4e7e-bf4d-73b42bbbbc8f.png"> # How The two missing pieces of information are sent in the [`Network.requestWillBeSentExtraInfo`](https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSentExtraInfo) event, under `headers` and `connectTiming.requestTime`. > I don't think we can actually get the `connectionStart`/`connectionEnd` timing, [as described here](https://developer.apple.com/documentation/foundation/nsurlsessiontasktransactionmetrics#3162615). Instead of fetching that value, we just skip it and let chrome devtools only show the actual response time. # Test Plan - Make a request `fetch('https://httpbin.org/anything')` - Check the network tab - Should NOT show `⚠️ Provisional headers are shown` - Should NOT show `Pending` under `Timing` # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev> (cherry picked from commit 0cf2d5a)
…event (#21965) # Why This fixes the last two remaining "weird debug information" in chrome devtools. 1. The request headers are marked as "⚠️ Provisional headers shown" 2. The `Timing` column is stuck on "Pending" instead of showing the actual request time. Page | Screenshot --- | --- Overview | <img src="https://user-images.githubusercontent.com/1203991/229575879-201d2b47-ff02-4512-adc3-72716fad71f8.png"> Headers tab | <img src="https://user-images.githubusercontent.com/1203991/229575999-b57c6428-a754-4e69-910e-a1cd76c9b761.png"> Timing tab | <img width="1030" alt="image" src="https://user-images.githubusercontent.com/1203991/229576107-d08d1f65-9203-4e7e-bf4d-73b42bbbbc8f.png"> # How The two missing pieces of information are sent in the [`Network.requestWillBeSentExtraInfo`](https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSentExtraInfo) event, under `headers` and `connectTiming.requestTime`. > I don't think we can actually get the `connectionStart`/`connectionEnd` timing, [as described here](https://developer.apple.com/documentation/foundation/nsurlsessiontasktransactionmetrics#3162615). Instead of fetching that value, we just skip it and let chrome devtools only show the actual response time. # Test Plan - Make a request `fetch('https://httpbin.org/anything')` - Check the network tab - Should NOT show `⚠️ Provisional headers are shown` - Should NOT show `Pending` under `Timing` # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev> (cherry picked from commit 0cf2d5a)
…event (#21965) # Why This fixes the last two remaining "weird debug information" in chrome devtools. 1. The request headers are marked as "⚠️ Provisional headers shown" 2. The `Timing` column is stuck on "Pending" instead of showing the actual request time. Page | Screenshot --- | --- Overview | <img src="https://user-images.githubusercontent.com/1203991/229575879-201d2b47-ff02-4512-adc3-72716fad71f8.png"> Headers tab | <img src="https://user-images.githubusercontent.com/1203991/229575999-b57c6428-a754-4e69-910e-a1cd76c9b761.png"> Timing tab | <img width="1030" alt="image" src="https://user-images.githubusercontent.com/1203991/229576107-d08d1f65-9203-4e7e-bf4d-73b42bbbbc8f.png"> # How The two missing pieces of information are sent in the [`Network.requestWillBeSentExtraInfo`](https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSentExtraInfo) event, under `headers` and `connectTiming.requestTime`. > I don't think we can actually get the `connectionStart`/`connectionEnd` timing, [as described here](https://developer.apple.com/documentation/foundation/nsurlsessiontasktransactionmetrics#3162615). Instead of fetching that value, we just skip it and let chrome devtools only show the actual response time. # Test Plan - Make a request `fetch('https://httpbin.org/anything')` - Check the network tab - Should NOT show `⚠️ Provisional headers are shown` - Should NOT show `Pending` under `Timing` # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev> (cherry picked from commit 0cf2d5a)
Why
This fixes the last two remaining "weird debug information" in chrome devtools.
Timing
column is stuck on "Pending" instead of showing the actual request time.How
The two missing pieces of information are sent in the
Network.requestWillBeSentExtraInfo
event, underheaders
andconnectTiming.requestTime
.Test Plan
fetch('https://httpbin.org/anything')
⚠️ Provisional headers are shown
Pending
underTiming
Checklist
expo prebuild
& EAS Build (eg: updated a module plugin).