-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
chore: reduce call stack in http client #6934
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #6934 +/- ##
============================================
- Coverage 62.52% 62.51% -0.01%
============================================
Files 575 575
Lines 60986 61014 +28
Branches 2118 2123 +5
============================================
+ Hits 38129 38141 +12
- Misses 22818 22834 +16
Partials 39 39 |
Performance Report✔️ no performance regression detected Full benchmark results
|
@@ -394,6 +396,10 @@ export class HttpClient implements IHttpClient { | |||
abortSignals.forEach((s) => s?.removeEventListener("abort", onSignalAbort)); | |||
} | |||
} | |||
|
|||
private getRequestMethod(requestFormat: `${WireFormat}`): typeof this._request { |
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.
that is this ${}
syntax in the method signature? First I've seen it used there
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.
If we use the enum type it is too strict as it only allows to pass values from the enum and not the same value as string literal
same type as we have for request options
requestWireFormat?: `${WireFormat}`; |
This allows the following
await api.beacon.getGenesis({responseWireFormat: "ssz"})
// instead of having to do
await api.beacon.getGenesis({responseWireFormat: WireFormat.ssz})
and you also get nice intellisense
More or less just a devex improvement
🎉 This PR is included in v1.20.0 🎉 |
Motivation
Makes call stack slightly easier to read if there are http errors
Description
Reduce call stack in http client by only calling
requestFallbackToJson
if request wireformat is ssz