graphql-dotnet / graphql-dotnet/graphql-client
Adding headers at the request level
- Dominant language
- C#
- Stars
- 648
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
I understand that you can add headers at the client level (that get sent for every request) but how can I add a header at the
request level.
e.g. This code shows how DefaultRequestHeaders can be set, but what if I wanted to add a request level header for say a Correlation Id?
```
var graphClient = new GraphQLClient("https://api.github.com/graphql");
graphClient.DefaultRequestHeaders.Add("Authorization", $"bearer {gitHubAccessToken}");
//var test = await graphClient.GetIntrospectionQueryAsync();
var request = new GraphQLRequest
{
Query = @"query { viewer { login } }"
};
var test = await graphClient.PostAsync(request);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.