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

match flask pattern to return extra headers #34

Merged
merged 2 commits into from Jul 31, 2022
Merged

Conversation

cardoe
Copy link
Contributor

@cardoe cardoe commented Apr 15, 2021

Technically Flask allows you to return from a route with a tuple of 3
items with the last item being a dictionary of headers. The docs mention
it here: https://flask.palletsprojects.com/en/1.1.x/quickstart/#about-responses
This adjusts the behavior of the validate decorator to allow this as
well. Matches the behavior in: https://github.com/pallets/flask/blob/64213fc0214c1044fa2c9e60d0e2683e75d125c0/src/flask/app.py#L1644-L1646

@cardoe cardoe force-pushed the headers branch 2 times, most recently from b27d4a8 to 257e660 Compare April 15, 2021 21:06
@sonarcloud
Copy link

sonarcloud bot commented Apr 15, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bauerji
Copy link
Owner

bauerji commented Apr 16, 2021

Hello @cardoe,

Thank you for contributing. Could please add tests to properly cover added functionality?

Jirka

@cardoe
Copy link
Contributor Author

cardoe commented Apr 16, 2021

Sure. I didn't see where the existing behavior of returning the tuple was tested because that's where I wanted to add a test for this so I assumed it was untested in general. Can you point me to the right spot?

@bauerji
Copy link
Owner

bauerji commented Apr 16, 2021

Let's not test the point of returning the tuple. I was thinking about testing the overall functionality of modifying response header. I. e. create test route returning 3-tuple and check whether it really has an effect on response headers.

Technically Flask allows you to return from a route with a tuple of 3
items with the last item being a dictionary of headers. The docs mention
it here: https://flask.palletsprojects.com/en/1.1.x/quickstart/#about-responses
This adjusts the behavior of the validate decorator to allow this as
well. Matches the behavior in: https://github.com/pallets/flask/blob/64213fc0214c1044fa2c9e60d0e2683e75d125c0/src/flask/app.py#L1644-L1646
@sonarcloud
Copy link

sonarcloud bot commented May 13, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@cardoe
Copy link
Contributor Author

cardoe commented May 13, 2022

I've implemented the test. Currently the testing fails on a test that's failing in master today.

@cardoe
Copy link
Contributor Author

cardoe commented May 18, 2022

@bauerji let me know if this test solves the need or what other steps I need to do.

@sonarcloud
Copy link

sonarcloud bot commented Jul 31, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bauerji
Copy link
Owner

bauerji commented Jul 31, 2022

Nice, thank you for contribution. I've made some adjustment in master branch, after rebasing all tests passed fine.

@bauerji bauerji merged commit 5951c48 into bauerji:master Jul 31, 2022
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

2 participants