fix: set canonical User-Agent header format#1576
Conversation
The User-Agent header is now always `workos-node/{VERSION}`,
matching the canonical WorkOS Node SDK format used through the
6.x line.
Three pieces of behavior added in later majors that broke
conformance are removed:
- Runtime detection no longer appended (e.g. `(node/v22.0.0)`)
- The `appInfo` option is still accepted for backwards
compatibility, but the value no longer affects the outgoing
User-Agent header
- The HTTP-client annotation injected by `addClientToUserAgent`
(e.g. `/fetch`) is dropped
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughUser-Agent header generation is simplified across the SDK. The implementation no longer appends runtime version information or app info details, reducing the User-Agent to a basic Changes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR simplifies the
Confidence Score: 5/5Safe to merge — the change is a straightforward simplification of User-Agent construction with no functional side-effects on request routing or auth. The change removes dead code and simplifies header construction to a static string. All existing tests were updated and pass. No request logic, auth flows, or error handling paths were touched. No files require special attention. Important Files Changed
|
Description
The outgoing
User-Agentheader is now alwaysworkos-node/{VERSION}— the canonical WorkOS Node SDK format used through the 6.x line. The 7.x and 8.x lines accumulated several augmentations that no longer conformed (/fetchHTTP-client annotation,(node/v22.0.0)runtime info,appName: appVerfromappInfo).Behavior changes
appInfooption still parses for backwards compatibility, but the value no longer affects theUser-Agentheader.Callers relying on these tokens being present in
User-Agentwill need to set a separate header via the request-options headers mechanism.Test plan
npm run lintnpm run typechecknpm test -- src/workos.spec.tsnpm test -- src/workos.spec.ts src/common/net/fetch-client.spec.tsnpx jest(683 passed, 0 failed)User-Agent: workos-node/{VERSION}on a real outgoing requestDocumentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
No WorkOS Docs changes are required for this cleanup.
Link to Devin session: https://app.devin.ai/sessions/7fb05fc5793448acbeb705fc97e36592
Requested by: @gjtorikian