[feat] Add support for censoring XML, HTML and raw text response bodies #52
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.
Description
XML, HTML and plain text body censoring seem to be working as expected and are ready for release into the wild.
This PR enables XML, HTML and plain text body censoring (content type is determined automatically by the library during censor processing; end-user does not need to define what type of content will be censored).
This PR features a few breaking changes:
CensorElement
is now an abstract base class that cannot be used directly. All previous uses ofCensorElement
likely want to be replaced byKeyCensorElement
(used to censor the value of a specified JSON/XML key).TextCensorElement
is introduced, to censor a specific text value. This works well if users don't know the key of a JSON/XML element they want to censor, but do know the value. For HTML/plain text, this will only work if the entire body text of HTML/plain text matches the provided value; usingRegexCensorElement
is more effective for HTML/plain text matching.CensorHeadersByKeys
,CensorBodyElementsByKeys
,CensorQueryParametersByKeys
andCensorPathElementsByPatterns
have been removed. Users should instead useCensorHeaders
,CensorBodyElements
,CensorQueryParameters
andCensorPathElements
and pass in lists ofCensorElement
-subtypes. This will allow users to easily mix-and-match censor elements (e.g. both by-key and by-regex censors on the same body)Testing
Pull Request Type
Please select the option(s) that are relevant to this PR.