forked from JohnnyCrazy/SpotifyAPI-NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtendedWebClient.cs
More file actions
29 lines (27 loc) · 987 Bytes
/
ExtendedWebClient.cs
File metadata and controls
29 lines (27 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Net.Http;
namespace SpotifyAPI.Local
{
internal class ExtendedWebClient : HttpClient
{
#if NET461
public ExtendedWebClient() : base()
{
Timeout = new TimeSpan(0, 0, 2);
DefaultRequestHeaders.Add("Origin", "https://embed.spotify.com");
DefaultRequestHeaders.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");
}
#else
private static readonly WinHttpHandler HttpHandler = new WinHttpHandler
{
ServerCertificateValidationCallback = (message, certificate2, arg3, arg4) => true
};
public ExtendedWebClient() : base(HttpHandler, false)
{
Timeout = new TimeSpan(0, 0, 2);
DefaultRequestHeaders.Add("Origin", "https://embed.spotify.com");
DefaultRequestHeaders.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");
}
#endif
}
}