Due to FormUrlEncodedContent's use of Uri.EscapeDataString() internally, it is unable to post values exceeding ~32k in length (Uri.EscapeDataString() is documented to throw UriFormatException if the string length exceeds 32766 characters). Some web services (in this case, Bill.com) require the use of application/x-www-form-urlencoded posts instead of something more sensible to upload files, so we have to build up the form body by hand. FormUrlEncodedContent.Encode should use a Uri string encoder not subject to the RFC limits (or get an overload added to Uri's that ignores them).
I hacked up a version of FormUrlEncodedContent that uses HttpUtility.UrlEncode, and it works fine (thanks, Reflector!), but I'm guessing nobody wants a dependency on System.Web...
Sample reproduction attached.
I hacked up a version of FormUrlEncodedContent that uses HttpUtility.UrlEncode, and it works fine (thanks, Reflector!), but I'm guessing nobody wants a dependency on System.Web...
Sample reproduction attached.