ory / sdk

The place where ORY's SDKs are being auto-generated
Apache License 2.0
137 stars 85 forks source link

Add the ability to set custom headers #298

Open batazor opened 9 months ago

batazor commented 9 months ago

Preflight checklist

Ory Network Project

No response

Describe your problem

In order to link my trace-id to events in ory/kratos I need to add W3C headers.

Currently there is no way to add headers to requests

Describe your ideal solution

Add method .SetHeaders(key, value) or .SetHeaders(map[string]string)

Workarounds or alternatives

As an option is the ability to pass the query context .Execute(ctx context.Context) and check for the presence of trace-span-id

Version

github.com/ory/client-go v1.2.11

Additional Context

No response

batazor commented 9 months ago

As an alternative, we can add this method to the template by analogy with the `.cookie' method

func (r FrontendApiToSessionRequest) SetHeader(key, value string) FrontendApiToSessionRequest {
    r.SetHeader(key, value)
    return r
}