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

Avoid JSON::ParserError when response body is no content #9

Merged
merged 2 commits into from
Sep 11, 2020

Conversation

uiur
Copy link
Contributor

@uiur uiur commented Sep 9, 2020

If an api endpoint returns response with no content like head :ok,
rspec-openapi raises json parse error.

      Failures:

         1) Tables #destroy returns no content if specified
            Failure/Error: response_body: response.parsed_body,

            JSON::ParserError:
              767: unexpected token at ''
            # ./lib/rspec/openapi/record_builder.rb:37:in `build'
            # ./lib/rspec/openapi/hooks.rb:12:in `block in <top (required)>'

This PR handles this parse error. It renders openapi spec without response body in this case.

Copy link
Collaborator

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@k0kubun k0kubun merged commit 1bf7a42 into exoego:master Sep 11, 2020
@uiur uiur deleted the no-content branch September 11, 2020 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants