Add action: Replace String in Response Value #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With these changes I add the option to replace a string in the value of a response header.
One can select this action in the table of the config menu. Under the header field value you then provide a pattern like so: (text to search for)(text to replace with). For example (apple)(boat) will replace 'apple' with 'boat' in the value of the response header.
I was looking for this feature since I needed to change the Content-Security-Policy of a page. However, the Content-Security-Policy was dynamically crafted with nonces. I did not want to delete the entire CSP; I wanted a CSP with these nonces still in there. As a regular modify (always to one certain, pre-specified value) could not achieve this, I needed a string replace option.
Hereby I share that feature. If it gets accepted to the master branch, the README.md would still have to be updated to explain this feature.