URI too long error (original) (raw)

When calling PostUrlEncodedAsync I'm receiving an error when the code tries to URL encode a large string (300kb).

      Invalid URI: The Uri string is too long.
System.UriFormatException: Invalid URI: The Uri string is too long.
   at System.UriHelper.EscapeString(String input, Int32 start, Int32 end, Char[] dest, Int32& destPos, Boolean isUriString, Char force1, Char force2, Char rsvd)
   at System.Uri.EscapeDataString(String stringToEscape)
   at Flurl.Url.EncodeQueryParamValue(Object value, Boolean encodeSpaceAsPlus) in C:\projects\flurl\src\Flurl.Shared\Url.cs:line 139
   at Flurl.Http.Configuration.DefaultUrlEncodedSerializer.Serialize(Object obj) in C:\projects\flurl\src\Flurl.Http.Shared\Configuration\DefaultUrlEncodedSerializer.cs:line 26
   at Flurl.Http.HttpExtensions.PostUrlEncodedAsync(IFlurlClient client, Object data, CancellationToken cancellationToken, HttpCompletionOption completionOption) in C:\projects\flurl\src\Flurl.Http.Shared\HttpExtensions.cs:line 513

The api we are calling is proprietary and does not accept POSTing application/json content. It only accepts a application/x-www-form-urlencoded payload.