Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use IRemoteContentStream without form content headers #9180

Merged
merged 12 commits into from
Sep 7, 2021

Conversation

alexandru-bagu
Copy link
Contributor

  1. allow the usage of IRemoteContentStream or RemoteContentStream when the incoming stream is not a form content format
  2. remove all rewinds related to streams; the user is the one who must ensure his streams are at the correct position when calling the api; stream rewind would exclude the ability of sending partial streams (at least skippable streams, because the tail cannot be limitted in .net core)
  3. RemoteStreamContent now must get the content type associated with the stream in its constructor; it may also receive the length of the stream in a read-only form (this is because some stream classes cannot provide the length and it is provided via http headers)
  4. IRemoteStreamContent should implement IDisposable to allow the auto clean up of streams (example: FileStream)

…n the incoming stream is not a form content format

2. remove all rewinds related to streams; the user is the one who must ensure his streams are at the correct position when calling the api; stream rewind would exclude the ability of sending partial streams (at least skippable streams, because the tail cannot be limitted in .net core)
3. RemoteStreamContent now must get the content type associated with the stream in its constructor; it may also receive the length of the stream in a read-only form (this is because some stream classes cannot provide the length and it is provided via http headers)
4. IRemoteStreamContent should implement IDisposable to allow the auto clean up of streams (example: FileStream)
@maliming maliming self-requested a review May 29, 2021 02:23
@maliming maliming added this to the 4.4-final milestone Jun 28, 2021
@maliming
Copy link
Member

allow the usage of IRemoteContentStream or RemoteContentStream when the incoming stream is not a form content format.

The FormData is the most common way in JavaScript.
If we want to support it, we also need to change the GenerateBody method.

if (parameters.Any(x => x.BindingSourceId == ParameterBindingSources.FormFile))

@alexandru-bagu
Copy link
Contributor Author

allow the usage of IRemoteContentStream or RemoteContentStream when the incoming stream is not a form content format.

The FormData is the most common way in JavaScript.
If we want to support it, we also need to change the GenerateBody method.

if (parameters.Any(x => x.BindingSourceId == ParameterBindingSources.FormFile))

I am not sure why GenerateBody would have to be changed. At the moment if you receive a request with a content-type different than some type of form then it would be processed as a IRemoteContentStream or RemoteContentStream. If in turn this would have to be then proxied to the application layer, the GenerateBody you are referring to would then encode it within a FormFile which would be fine as the application layer would then read the proper content-type from inside the form file content headers.

From a JS point of view I guess there's no way to easily send a file or a stream. But this is mostly a change for backend api calls not necessarily for frontend. Is this what you are talking about or something else?

@maliming maliming modified the milestones: 4.4-final, 5.0-preview Jun 29, 2021
@maliming maliming merged commit c86d840 into abpframework:dev Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants