Skip to content

Commit

Permalink
BUG/MEDIUM: rules: add redirect_url when flattening (#200)
Browse files Browse the repository at this point in the history
It was reported that when using `redirect_url` changes were being
presented when applying a plan, even though there were not any changes
being made.

This was due to `redirect_url` not being reset during rule flattening
within `flattenRuleActions`.

This commit fixes that and adds `redirect_url` to the `actionmap` within
`flattenRuleActions`.
  • Loading branch information
daniel-corbett authored Oct 24, 2023
1 parent d01f1f7 commit 2feaf97
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions provider/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ func flattenRuleActions(actions []sigsci.Action, customResponseCode bool) []inte
// response code is set to 0 by sigsci api when action.type != "block"
// for types such as "allow" or "logRequest", response code is irrelevant and hence not provided in API response
actionMap["response_code"] = action.ResponseCode

if action.ResponseCode == 301 || action.ResponseCode == 302 {
actionMap["redirect_url"] = action.RedirectURL
}
}
actionsMap[i] = actionMap
}
Expand Down

0 comments on commit 2feaf97

Please # to comment.