reactiveui / refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.
https://reactiveui.github.io/refit/
MIT License
8.66k stars 745 forks source link

[BUG] Buffering and WebAPI (resurrecting) #1250

Open kmcclellan opened 3 years ago

kmcclellan commented 3 years ago

Describe the bug

I've been encountering compatibility issues between .NET WebAPI and Refit's streaming (i.e. non-buffered) protocol.

After a lot of testing, I found that setting Buffered = true fixes these issues. I found this old issue which seems to report the same problems when streaming is used.

The previous issue was closed after buffering was switched to opt-in. However, it was subsequently changed back to opt-out.

What should be the default value for RefitSettings.Buffered? Even if the answer is true, what's the root cause for WebAPI's failing to deserialize large (>1500 bytes) streaming requests?

kmcclellan commented 3 years ago

Does the streaming implementation follow the spec regarding transfer-encoding:chunked?

SuarezAlexis commented 1 year ago

Got this same issue. I was sending a POST request with a large JSON body and it was sent empty unless I read the body content before sending. It took much time and tests to find out this was the real problem. The issue was fixed thanks to this workaround: Set Refit.Settings.Buffered = true