-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to ignore elements when matching by body (#6)
- Ability to ignore elements when matching by body - Reuse censoring code, made functions static - Header, body and query censors now case-sensitive on a per-element basis
- Loading branch information
Showing
18 changed files
with
577 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.easypost.easyvcr; | ||
|
||
public class CensorElement { | ||
/** | ||
* The name of the element to censor. | ||
*/ | ||
private final String name; | ||
/** | ||
* Whether the name must match exactly to trigger a censor. | ||
*/ | ||
private final boolean caseSensitive; | ||
|
||
/** | ||
* Constructor. | ||
* @param name The name of the element to censor. | ||
* @param caseSensitive Whether the name must match exactly to trigger a censor. | ||
*/ | ||
public CensorElement(String name, boolean caseSensitive) { | ||
this.name = name; | ||
this.caseSensitive = caseSensitive; | ||
} | ||
|
||
/** | ||
* Return whether the element matches the name, accounting for case sensitivity. | ||
* @param key The name to check. | ||
* @return True if the element matches the name. | ||
*/ | ||
public boolean matches(String key) { | ||
if (caseSensitive) { | ||
return key.equals(name); | ||
} else { | ||
return key.equalsIgnoreCase(name); | ||
} | ||
} | ||
} |
Oops, something went wrong.