Skip to content

[BUG] [Ruby] Client does not form-encode PUT requests #3138

@dkliban

Description

@dkliban

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The Ruby client relies on Typhoeus to make http requests. Due to typhoeus/typhoeus#389 the generated Ruby client does not form encode PUT requests even when the Content-Type is supposed to be 'multipart/form-data'. POST requests are form-encoded just fine.

openapi-generator version

latest master branch

OpenAPI declaration file content or url

https://docs.pulpproject.org/en/3.0/nightly/api.json

Command line used for generation
docker run -u $(id -u) --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
    -i /local/api.json \
    -g ruby \
    -o /local/pulpcore-client \
    -DgemName=pulpcore_client \
    -DgemLicense="GPLv2" \
    -DgemVersion=3.0.0rc2 \
    --skip-validate-spec \
    --strict-spec=false
Steps to reproduce
require 'pulpcore_client'
PulpcoreClient.configure do |config|
          config.host= "http://localhost:24817"
          config.username= 'admin'
          config.password= 'admin'
end

api_instance = PulpcoreClient::UploadsApi.new
content_range = "bytes 0-2373/2373" # String | The Content-Range header specifies the location of the file chunk within the file.

file = File.new('katello.gemspec') # File | A chunk of a file to upload.

begin
  #Start Upload
  result = api_instance.uploads_create(content_range, file)
  p result
rescue PulpcoreClient::ApiError => e
  puts "Exception when calling UploadsApi->uploads_create: #{e}"
end
Related issues/PRs

swagger-api/swagger-codegen#7889
typhoeus/typhoeus#389

Suggest a fix

Add ability to use a different library to perform requests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions