Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RED-2026] Set a default user agent so Zendesk can identify the requests #323

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ZendeskApi.Build/ZendeskApi.Commons.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PropertyGroup>
<Major>7</Major>
<Minor>0</Minor>
<Revision>5</Revision>
<Revision>6</Revision>
<PackageVersion>$(Major).$(Minor).$(Revision)</PackageVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/ZendeskApi.Client/ZendeskApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public HttpClient CreateClient(string resource = null)
var authorizationHeader = _options.GetAuthorizationHeader();
mikerogers123 marked this conversation as resolved.
Show resolved Hide resolved

client.DefaultRequestHeaders.Add("Authorization", authorizationHeader);
client.DefaultRequestHeaders.UserAgent.ParseAdd("justeat.zendesk-api-client-csharp");

client.DefaultRequestHeaders
.Accept
Expand All @@ -73,7 +74,7 @@ public HttpClient CreateServiceStatusClient()
{
BaseAddress = new Uri("https://status.zendesk.com")
};

client.DefaultRequestHeaders.UserAgent.ParseAdd("justeat.zendesk-api-client-csharp");
client.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("application/json"));
Expand Down
7 changes: 4 additions & 3 deletions src/ZendeskApi.Client/ZendeskApiClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public HttpClient CreateClient(string resource = null)

client.DefaultRequestHeaders
.Add(
"Authorization",
"Authorization",
authorizationHeader);
client.DefaultRequestHeaders.UserAgent.ParseAdd("justeat.zendesk-api-client-csharp");

client.DefaultRequestHeaders
.Accept
Expand All @@ -57,7 +58,7 @@ public HttpClient CreateServiceStatusClient()
.CreateClient();

client.BaseAddress = new Uri("https://status.zendesk.com");

client.DefaultRequestHeaders.UserAgent.ParseAdd("justeat.zendesk-api-client-csharp");
client.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("application/json"));
Expand All @@ -68,4 +69,4 @@ public HttpClient CreateServiceStatusClient()
return client;
}
}
}
}