| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The SDK base UA now includes the Node.js version and OS platform/arch alongside the SDK name and version: socketsecurity-sdk/1.4.96 node/v22.0.0 linux/arm64 When callers pass a userAgent option it is appended rather than replacing the base, so the full string becomes: socketsecurity-sdk/1.4.96 node/v22.0.0 linux/arm64 socket/1.1.96 (https://github.com/SocketDev/socket-cli) Add buildSdkBaseUserAgent() internal helper for the SDK's own base token. Update createUserAgentFromPkgJson() JSDoc to clarify it builds a caller token to be passed via SocketSdkOptions.userAgent.
There was a problem hiding this comment.
This PR enriches the SDK’s default User-Agent header by including runtime environment details (Node.js version and OS platform/arch) alongside the SDK name/version, and changes the userAgent option behavior to append an additional caller token rather than replace the base SDK user agent.
Changes:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| 'User-Agent': userAgent | ||
| ? `${DEFAULT_USER_AGENT} ${userAgent}` | ||
| : DEFAULT_USER_AGENT |
| 'User-Agent': userAgent | ||
| ? `${DEFAULT_USER_AGENT} ${userAgent}` | ||
| : DEFAULT_USER_AGENT |
| function buildSdkBaseUserAgent(pkgData: { | ||
| name: string | ||
| version: string | ||
| }): string { | ||
| const name = pkgData.name.replace('@', '').replace('/', '-') | ||
| return [ |
The default User-Agent now includes the running Node.js version and the OS platform/arch alongside the SDK name/version, built by a new buildSdkBaseUserAgent helper in user-agent.mts. A caller-supplied userAgent is now appended to that base rather than replacing it, so requests always carry the SDK's own identifying token. Ports #638 (based on the v1.4.x line) to v4/main. Example emitted header: socketsecurity-sdk/4.0.4 node/v24.14.1 linux/arm64 socket/1.1.96 (https://github.com/SocketDev/socket-cli)
|
Superseded. The default user-agent enrichment (Node.js version + OS platform/arch, with a caller-supplied userAgent appended rather than replacing the base) has been ported to v4/main in #665 (squashed as 6cee256). This PR was based on the retired v1.4.x line, so the change belongs on main instead. Closing. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The SDK base UA now includes the Node.js version and OS platform/arch alongside the SDK name and version:
socketsecurity-sdk/1.4.96 node/v22.0.0 linux/arm64
When callers pass a userAgent option it is appended rather than replacing the base, so the full string becomes:
socketsecurity-sdk/1.4.96 node/v22.0.0 linux/arm64 socket/1.1.96 (https://github.com/SocketDev/socket-cli)
Add buildSdkBaseUserAgent() internal helper for the SDK's own base token. Update createUserAgentFromPkgJson() JSDoc to clarify it builds a caller token to be passed via SocketSdkOptions.userAgent.