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

Allow Host header setting #570

Merged
merged 2 commits into from
Nov 4, 2022
Merged

Allow Host header setting #570

merged 2 commits into from
Nov 4, 2022

Conversation

romanblanco
Copy link
Member

@romanblanco romanblanco commented Nov 4, 2022

Problem

Missing option to set Host header.

Closes: #184.

Solution

There already is reviewed solution in #184.
This PR only adds test coverage to help the changes get merged.

This concerns this parts of the Open API Specification:

The changes I made are compatible with:

  • OAS2
  • OAS3
  • OAS3.1

Related Issues

Checklist

  • Added tests
  • Changelog updated
  • Added documentation to README.md

Steps to Test or Reproduce

...

@jtannas jtannas merged commit f6227cb into rswag:master Nov 4, 2022
@romanblanco romanblanco deleted the host-header branch November 5, 2022 13:27
# Host header
host = metadata[:operation][:host] || swagger_doc[:host]
if host.present?
host = example.respond_to?(:'Host') ? example.send(:'Host') : host
Copy link
Contributor

Choose a reason for hiding this comment

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

@jtannas I was wondering if you might have meant: example.respond_to?(:'host') ? example.send(:'host') here? (lower case h.) My tests broke after this change, where RSpec started trying to use my live production API host instead of the test host. example.host returns the correct test value for me, but I don't have a example.Host method.

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.

None yet

4 participants