Repository navigation
Allow custom FalconClient user agents - #326
carlosmmatos-cs merged 2 commits into
Conversation
Reject overrides containing spaces in the wrong place, token delimiters, or CR/LF before they reach the User-Agent header. Trim surrounding whitespace so a padded value composes cleanly, and escape the offending value in the thrown error to avoid log injection.
|
Thanks for this @ting-hong-shieh . Nice change that was needed. I pushed one commit on top of yours ( What the commit does:
Valid identifiers like One call I made: it throws on bad input rather than silently falling back to the default, since a wrong User-Agent is easy to miss otherwise. Happy to switch it to warn-and-fallback if you'd prefer that. |
|
Hi @carlosmmatos-cs, thanks for adding the validation. Throwing on invalid input makes sense to me and is preferable to silently falling back. The trimming behavior and product-token validation look good. |
Summary
Add an optional
userAgentOverridesetting toFalconClientOptions.When set, FalconJS prepends the integration identifier to its existing SDK identifier. The same header is used for OAuth token requests and subsequent API requests. For example:
The default remains
falconjs/0.7.0when no override is provided. The README now documents the option and resulting header.Closes #221.
Validation
pnpm run buildpnpm run lint