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:
barelyprofessional
2026-03-05 09:20:57 -06:00
parent c8dcf8e884
commit d01fbe6ce3

View File

@@ -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);