OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.3k stars 6.44k forks source link

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

Open dkliban opened 5 years ago

dkliban commented 5 years ago

Bug Report Checklist

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

https://github.com/swagger-api/swagger-codegen/issues/7889 https://github.com/typhoeus/typhoeus/issues/389

Suggest a fix

Add ability to use a different library to perform requests.

auto-labeler[bot] commented 5 years ago

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

ackintosh commented 5 years ago

@dkliban Thanks for reporting this issue!

FYI related issue: https://github.com/OpenAPITools/openapi-generator/issues/1422

cc: @meganemura