Skip to content

Commit

Permalink
Use HttpClient in sdk generator
Browse files Browse the repository at this point in the history
  • Loading branch information
purkhusid committed Apr 3, 2024
1 parent 4746e94 commit 2caddee
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions dotnet/private/sdk/gen/Sdk.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open System.Text.Json
open System.Text
open System.Collections.Generic
open NuGet.RuntimeModel
open System.Net.Http

let private supportedChannels = [ "6.0"; "7.0"; "8.0" ]

Expand Down Expand Up @@ -58,19 +59,16 @@ let private releaseJsonUrl channel =


let private downloadReleaseInfoForChannel channel =
let webClient = new WebClient()
let httpClient = new HttpClient()
let url = releaseJsonUrl channel

let json = webClient.DownloadString(url)
let json = httpClient.GetAsync(url).Result.Content.ReadAsStringAsync().Result
JsonSerializer.Deserialize<Channel>(json)

let private downloadRuntimes () =
let webClient = new WebClient()
let httpClient = new HttpClient()

let json =
webClient.DownloadString(
"https://raw.githubusercontent.com/dotnet/runtime/main/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json"
)
let json = httpClient.GetAsync("https://raw.githubusercontent.com/dotnet/runtime/main/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json").Result.Content.ReadAsStringAsync().Result

JsonSerializer.Deserialize<Runtimes>(json)

Expand Down

0 comments on commit 2caddee

Please sign in to comment.