Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from codiga/remove-graphql-user-agent
Browse files Browse the repository at this point in the history
Remove GraphQL user agent
  • Loading branch information
dastrong-codiga authored Dec 13, 2022
2 parents 9d87074 + 75de4ee commit 5b75d19
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GraphQLClient/CodigaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ public class CodigaClient : ICodigaClient, IDisposable

public string Fingerprint { get; }

public CodigaClient(string fingerprint)
//For testing
public CodigaClient(string fingerprint) : this(null, fingerprint)
{
_client = new GraphQLHttpClient(CodigaEndpoint, new SystemTextJsonSerializer());
_client.HttpClient.DefaultRequestHeaders.Add("User-Agent", GetUserAgent());
Fingerprint = fingerprint;
}

public CodigaClient(string apiToken, string fingerprint)
public CodigaClient(string? apiToken, string fingerprint)
{
Fingerprint = fingerprint;
_client = new GraphQLHttpClient(CodigaEndpoint, new SystemTextJsonSerializer());
//This removes the User-Agent completely, so that GraphQL's own user agent (e.g. GraphQL.Client/5.1.0.0) is not sent
_client.HttpClient.DefaultRequestHeaders.Remove("User-Agent");
_client.HttpClient.DefaultRequestHeaders.Add("User-Agent", GetUserAgent());

if (!string.IsNullOrEmpty(apiToken))
Expand Down

0 comments on commit 5b75d19

Please sign in to comment.