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

support for binary request body and binary response in ruby #1655

Open
Tracked by #1 ...
baywet opened this issue Jun 23, 2022 · 2 comments
Open
Tracked by #1 ...

support for binary request body and binary response in ruby #1655

baywet opened this issue Jun 23, 2022 · 2 comments
Labels
enhancement New feature or request Ruby
Milestone

Comments

@baywet
Copy link
Member

baywet commented Jun 23, 2022

related to #134 and associated pull request.

The http request adapter implementation needs to handle binary requests (photo upload) and binary responses (file download). This may require additional methods to be defined in the request adapter interface and the executor generator method to be updated.

@baywet
Copy link
Member Author

baywet commented Jan 3, 2023

After doing some research it appears that streams are materialized by the IO class.
We might need to set the raw body of the request and access the raw body of the response, as well as to configure the multipart middleware, more information

payload[:raw_data] = Faraday::Multipart::ParamPart.new(
  { a: 1 }.to_json,
  'application/json'
)

When the request/response body is a string type, we'll have to use the stringIO wrapper which probably won't any memory improvements but will standardize the kind of objects we're passing around between the layers to support scenarios like uploading files.

Note: parseNode and serialization writer will have to implement close, and the code-gen will need to be updated to use blocks to auto-close instances

Edit for primitives https://stackoverflow.com/questions/7862735/deserialize-json-primitives-with-the-built-in-ruby-json-library

@baywet
Copy link
Member Author

baywet commented May 16, 2023

This also needs to be handled in the serialization code

"binary" or "Binary" or "base64" or "base64url" => "get_string_value()", //TODO: add support for binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Ruby
Projects
Status: Todo 📃
Development

No branches or pull requests

2 participants