Skip to content

Feature request: Implement scoped default headers for SDK client #111

@mgm1313

Description

@mgm1313

I'd like a straightforward way to set default headers for requests. This is important for us because we use headers like Accept-Language and User-Agent for analytical purposes, among other things.

The api could extend the one proposed in #110 :

export async function createAgent({
  domain,
  locale,
}: AgentProps) {
  const baseUrl = someLogicToDetermineBaseUrl(domain);
  const userAgent = getVersionString()

  const agent = new sdk.client({
    defaultConfiguration: {
      baseUrl: new URL(baseUrl),
      headers: {
        'Accept-Language': locale,
        'User-Agent': userAgent,
      }
    }
  });
  return agent;
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions