-
Notifications
You must be signed in to change notification settings - Fork 81
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
Allow user-provided User-Agent request header #1271
Comments
The user-agent set by connect-es is important to use because it helps users and us to diagnose issues. Can you provide some details on why it is important to you to override the header? |
It is very important to add information not only about connect-es, but also about runtime and even about the product |
Okay, it's reasonable to not set the User-Agent request header if the user already provided one via This applies to the Connect, gRPC, and gRPC-Web transports, but not to the ones from Until this change is made, you can use an interceptor to set a custom user agent: const transport = createConnectTransport({
baseUrl: "https://demo.connectrpc.com",
interceptors: [
(next) => async (req) => {
req.header.set("User-Agent", "FOO");
return await next(req);
}
]
}); |
The problem is: Using interceptors introduces unnecessary overhead, especially when using AsyncLocalStorage. |
Closed by #1272. It would be convenient to have a transport-level option, but we try to keep the API lean. Interceptors (as suggested in #1271 (comment)), shouldn't have a perceivable impact on performance. |
connect-es/packages/connect/src/protocol-grpc/request-header.ts
Line 43 in 3d10191
User header must have priority and override useragent header defined buy library
The text was updated successfully, but these errors were encountered: