0

I'm trying to Post an OFX request to a bank server with RestSharp. I have succeeded in getting the desired transaction data from the server. However, when the request body exceeds 1024 bytes, an Expect header is being added to the request. Normally, I'd just avoid the complexity and try to keep the request under 1024 bytes, but that is unavoidable with a few of the queries I want to run.

Unfortunately, the server does not support expect headers and throws an error if it receives one. I have been unable so far to identify how to prevent RestSharp from adding the Expect header. The code I'm using looks roughly like what I have below:

var client = new RestClient("https://bankwebsite.com");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-ofx");
request.AddHeader("Accept", "*/*, application/x-ofx");
request.AddParameter("application/x-ofx", ofxString, ParameterType.RequestBody);
var response = client.Execute(request);

Is there a setting I'm missing? Is this intrinsic to how these requests are formed? I'm relatively new to working with HTTP, so I'm most likely missing something. I've tried setting ServicePointManager.Expect100Continue to false, which didn't change any behavior.

Using HttpClient instead of RestSharp has caused huge issues, so I would like to avoid that if I can.

I'm using RestSharp 106.2.1 with .Net Core 2.0 on MacOS.

  • Probably you need to increase request body size limit in the server https://stackoverflow.com/questions/38698350/increase-upload-file-size-in-asp-net-core – Rudresha Parameshappa Mar 10 '18 at 23:45
  • I unfortunately don't have any control over the server. In this case I am querying a major bank api. I did look to see if I could find any request body size parameters on the client side, but I couldn't find any. – Ryan Rightmer Mar 11 '18 at 01:02

0 Answers0