Skip to content

Commit

Permalink
fix: user agent parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-tihon committed Jan 6, 2025
1 parent 9654098 commit d423186
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ open System.Net.Http
[<Literal>]
let Schema = __SOURCE_DIRECTORY__ + "/../Schemas/v2/github.json"

[<Literal>]
let UserAgent =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"


[<Literal>]
let Host = "https://api.github.com"

Expand All @@ -18,9 +23,8 @@ let github() =
let client = GitHub.Client()
client.HttpClient.BaseAddress <- Uri Host

"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|> Headers.ProductInfoHeaderValue.Parse
|> client.HttpClient.DefaultRequestHeaders.UserAgent.Add
client.HttpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", UserAgent)
|> ignore

client

Expand All @@ -32,9 +36,8 @@ let taskGitHub() =
let client = TaskGitHub.Client()
client.HttpClient.BaseAddress <- Uri Host

"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|> Headers.ProductInfoHeaderValue.Parse
|> client.HttpClient.DefaultRequestHeaders.UserAgent.Add
client.HttpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", UserAgent)
|> ignore

client

Expand Down

0 comments on commit d423186

Please sign in to comment.