refit icon indicating copy to clipboard operation
refit copied to clipboard

[BUG] Buffering and WebAPI (resurrecting)

Open kmcclellan opened this issue 4 years ago • 2 comments

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 avatar Oct 06 '21 19:10 kmcclellan

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

kmcclellan avatar Oct 06 '21 19:10 kmcclellan

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

SuarezAlexis avatar Jul 16 '23 22:07 SuarezAlexis