You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm frustrated when i am using this library to upload a file to GCP Storage.
RestSharp 110.2.0 do have an method AddFile(parameterName, getFile, fileName, contentType) to supply a IO stream to body. However, RestSharp compose the request into multipart/formdata causes GCP Storage API to write the content into the file.
Using native .NET HttpClient allows me to compose the IO stream as stream content var request = new HttpRequestMessage { Content = new StreamContent(sourceFileStream), };
which flawlessly achieved the goal.
And yes, I understand that using AddParameter(parameterName, rawByteArray, ParameterType.RequestBody) can achieve that, but when the byte array is too big, it going to eat up a lot of memory.
Therefore, allowing passing ContentStream as request content is really important.
Disclaimer:
I might missing some method in RestSharp to achieve that. Your help is much appreciated
Activity
alexeyzimarev commentedon Feb 7, 2024
It has been fixed, maybe not released #2068