Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13943
Closed
Open
Issue created Nov 07, 2022 by Administrator@rootContributor

[BUG][Ruby] Faraday - handle HTTP 0 without Typhoeus/libcurl

Created by: jethrodaniel

Description

When using the Ruby faraday library The Ruby client, when built with the faraday library option, currently handles HTTP 0 response in a curl/typhoeus specific way, which errors if you're using a different adapter (which is the default case).

The actual error is a no method error for return_message on Faraday::Response.

openapi-generator version

openapitools/openapi-generator-cli:v6.2.0

Generation Details

Relevant portion of openapi-generator-config.yaml :

library: faraday
gemRequiredRubyVersion: '>= 2.7'
Suggest a fix

Fix is simple, just add a respond_to? here in the response.status == 0 conditional: https://github.com/OpenAPITools/openapi-generator/blob/3eec4eb326a6c7abd49dcd60e63f3019b966466f/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache#L15-L26

i.e,

           unless response.success?
-            if response.status == 0
+            if response.status == 0 && response.respond_to?(:return_message)
               # Errors from libcurl will be made visible here
               fail ApiError.new(code: 0,
                                 message: response.return_message)
Assignee
Assign to
Time tracking