Skip to content

Commit 628c7bf

Browse files
committed
Don't set form-urlencoded header for Get requests
The C# runtime used by Unity fails for Get requests with `System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.`
1 parent 1204490 commit 628c7bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modio/Http/Connection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private HttpRequestMessage BuildRequest(Request request)
7070
{
7171
req.Content = content;
7272
}
73-
else
73+
else if (request.Method != HttpMethod.Get)
7474
{
7575
// It's safe to always set the content type to `x-www-form-urlencoded` if no content is set.
7676
req.Content = new FormUrlEncodedContent(Enumerable.Empty<KeyValuePair<string?, string?>>());

0 commit comments

Comments
 (0)