Skip to content

[Feature request] Add support for per-request custom HTTP headers in SDK API calls #569

@dyeam0

Description

@dyeam0

Checklist

Describe the problem you'd like to have solved

Problem statement

Currently, the Go and .NET OpenFGA SDKs do not provide a direct way to add custom HTTP headers to the API requests they generate on a per-request basis. This limits the ability to pass along valuable contextual information from client applications to the OpenFGA server and any intermediate networking infrastructure (like API gateways or service meshes). For example, it's a common requirement to propagate tracing information (ex., correlation IDs, trace IDs, span IDs) or other internal metadata for logging, debugging, or routing purposes. Without this capability, we lose end-to-end observability and have a significant gap in viewing and using metadata appropriately.

Describe the ideal solution

Proposed solution

Enhance the Go and .NET OpenFGA SDKs to allow developers to specify custom HTTP headers for each API call on a per-request basis. This could be achieved by adding an optional headers parameter to the method signature of the API client's functions (check, write, read, etc.).

This would give developers the flexibility to inject any necessary headers, such as:

  • Internal request IDs for logging and correlation
  • Distributed tracing headers
  • Client-specific metadata for auditing purposes

Adding this capability would significantly improve the integration of OpenFGA into existing production systems in the areas of observability, auditing, debugging, and more.

Alternatives and current workarounds

There are many, but all are less than ideal. One example:

  • Correlation of a patchwork of internal application logs. This is a manual process or a brittle, custom internal integration.

References

No response

Additional context

There are already methods to set custom default headers but no way to set the headers on a per-request basis.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnet-sdkAffects the C#/DotNet SDKenhancementNew feature or requestgo-sdkAffects the Go SDKjava-sdkAffects the Java/Kotlin SDKjs-sdkAffects the JavaScript SDKpython-sdkAffects the Python SDKruby-sdk

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions