Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

@salesforce/b2c-tooling-sdk / clients / createUserAgentMiddleware

Function: createUserAgentMiddleware()

createUserAgentMiddleware(config): Middleware

Defined in: packages/b2c-tooling-sdk/src/clients/middleware.ts:233

Creates middleware that sets the User-Agent header on requests.

Sets both the standard User-Agent header and a custom sfdc_user_agent header with the same value.

Parameters

config

UserAgentConfig

Configuration with the User-Agent string

Returns

Middleware

Middleware that sets the User-Agent headers

Example

typescript
const client = createOcapiClient(config, auth);
client.use(createUserAgentMiddleware({ userAgent: 'b2c-cli/0.1.0' }));

Released under the Apache-2.0 License.