mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
C# is so frustrating with HTTP. You couldn't imagine a more annoyingly autistic in the worst way possible HTTP client. Won't let you do anything to make it real world usable, and also enforces shit at runtime so you can't tell something is busted until hours later when your method finally hits.
Anyway it balked at the Accept header but some more testing in curl reveals that perhaps that's not what the issue is, that it's freaking out due to a missing Origin and Referer headers. Though testing might be impeded by caching, it's hard to say.
This commit is contained in:
@@ -185,8 +185,8 @@ public class Shuffle : IDisposable
|
||||
_logger.Debug($"Configured to use proxy {_proxy}");
|
||||
}
|
||||
using var client = new HttpClient(handler);
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/graphql-response+json,application/json;q=0.9"));
|
||||
client.DefaultRequestHeaders.Referrer = new Uri($"https://shuffle.com/?md-id={betId}&modal=bet");
|
||||
client.DefaultRequestHeaders.TryAddWithoutValidation("Origin", "https://shuffle.com");
|
||||
var postBody = JsonContent.Create(jsonBody);
|
||||
var response = await client.PostAsync("https://shuffle.com/main-api/graphql/api/graphql", postBody, _cancellationToken);
|
||||
var responseContent = await response.Content.ReadFromJsonAsync<JsonElement>(cancellationToken: _cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user