Skip to content

redirect: add support to specify response code#2030

Merged
mattklein123 merged 4 commits intomasterfrom
redirect_response
Nov 9, 2017
Merged

redirect: add support to specify response code#2030
mattklein123 merged 4 commits intomasterfrom
redirect_response

Conversation

@ccaraman
Copy link
Contributor

@ccaraman ccaraman commented Nov 9, 2017

This PR allows for redirect actions to specify which HTTP Status code to return.

Consuming the enums created in envoyproxy/data-plane-api#225

Risk Level: Low
Testing: Unit Test
Signed-off-by: Constance Caramanolis ccaramanolis@lyft.com

Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

thanks, few small comments

* Send a redirect response.
* @param callbacks supplies the filter callbacks to use.
* @param new_path supplies the redirect target.
* @param status_code supplies the response code to use.
Copy link
Member

Choose a reason for hiding this comment

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

nit: status_code vs. response_code below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

return matches;
}

Http::Code ConfigUtility::parseRedirectResponseCode(
Copy link
Member

Choose a reason for hiding this comment

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

please make sure you have coverage over all of this. There should be some tests in config_impl_test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test case in config_impl_test.cc

Copy link
Member

Choose a reason for hiding this comment

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

You need an actual test that loads a route table, gets the route, and makes sure a code is set. You don't have any test to make sure that that part is working. This should be in config_impl_test also. This may require converting one of the tests over to v2 YAML like we have been doing lately in other tests.

Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
danielhochman
danielhochman previously approved these changes Nov 9, 2017
Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
@mattklein123 mattklein123 merged commit 19ed39a into master Nov 9, 2017
@mattklein123 mattklein123 deleted the redirect_response branch November 9, 2017 23:50
jpsim added a commit that referenced this pull request Nov 28, 2022
The patch is no longer needed as it was similarly patched upstream in
nlohmann/json#3101.

That patch was then shipped in v3.10.5, which is the version used in Envoy now.

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim added a commit that referenced this pull request Nov 29, 2022
The patch is no longer needed as it was similarly patched upstream in
nlohmann/json#3101.

That patch was then shipped in v3.10.5, which is the version used in Envoy now.

Signed-off-by: JP Simard <jp@jpsim.com>
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.

3 participants