Skip to content

Support multi-value headers in expect_header, expect_header_contains #1

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

Open
wants to merge 1 commit into
base: merge/extend-expect_header
Choose a base branch
from

Conversation

Dakad
Copy link

@Dakad Dakad commented Oct 26, 2024

REF: brooklynDev#80

What does this PR do?

Some response headers, like Set-Cookie, can be specified multiple times. That results in an array of values. Calling expect_header or expect_header_contains against one of these headers causes an exception:

Failure/Error: expect_header_contains(:set_cookie, 'foo')
NoMethodError:
undefined method `downcase' for #Array:0x007f9d811b64c8

This patch adds support for headers with multiple values, checking the expectation against each value in the list and passing if any one value passes.

Associated ticket number and/or AirBrake error?

Due Date or Desirable Merge

How has this been tested?

Anticipated impact

How do you plan to monitor the change in prod to make sure it's working?

Checklist

  • My code follows the code style of this project.
  • I have run tests locally (manual tests and otherwise).
  • This has been tested on staging.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • My change includes a database modification
    • I have tested my database modification in staging.
  • My change breaks API retrocompatibility.
    • I have notified the frontend developers concerned about this change.
    • I have notified the public API consumers about this change. (DataPi)
  • My change affects endpoints for console or search-ads integrations. If so:
    • I am tagging a reviewer to explicitly review the security of this change: (flag reviewer here)
  • My changes require changes in other components/squads/teams
    • I already did the changes in the other components or notified the responsible people that the changes need to be done
    • The needed changes are already deployed or ready to be deployed

@Dakad Dakad self-assigned this Oct 26, 2024
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