mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 08:50:42 +02:00
config: only validate redirect response code when non-nil (#5358)
* config: only validate redirect response code when non-nil * update unit tests --------- Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
This commit is contained in:
parent
526e2a58d6
commit
c8b6b8f1a9
3 changed files with 30 additions and 30 deletions
|
@ -233,12 +233,10 @@ func (r *PolicyRedirect) validate() error {
|
|||
|
||||
// GetEnvoyResponseCode returns the ResponseCode as the corresponding Envoy enum value.
|
||||
func (r *PolicyRedirect) GetEnvoyResponseCode() (envoy_config_route_v3.RedirectAction_RedirectResponseCode, error) {
|
||||
var code int32
|
||||
if r != nil && r.ResponseCode != nil {
|
||||
code = *r.ResponseCode
|
||||
if r == nil || r.ResponseCode == nil {
|
||||
return envoy_config_route_v3.RedirectAction_RedirectResponseCode(0), nil
|
||||
}
|
||||
|
||||
switch code {
|
||||
switch code := *r.ResponseCode; code {
|
||||
case http.StatusMovedPermanently:
|
||||
return envoy_config_route_v3.RedirectAction_MOVED_PERMANENTLY, nil
|
||||
case http.StatusFound:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue