Skip to content

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

Closed

Description

@baywet

related to microsoft/kiota#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.

Activity

  1. added
    enhancement
    ruby
    on Jun 23, 2022
  2. baywet commented on Jan 3, 2023

    @baywet
    MemberAuthor

    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

  3. andreaTP commented on Oct 7, 2026

    @andreaTP
    Contributor

    Fixed:

    binary responses are read through send_primitive_async(..., StringIO, ...), and stream request bodies are sent. Both round-trip bytes intact on 0.24.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementruby

    Type

    No type

    Projects

    • Status
      Done ✔️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions