forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoLogModifier.java
42 lines (33 loc) · 897 Bytes
/
DemoLogModifier.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package demo.headers;
import com.intuit.karate.http.HttpLogModifier;
/**
*
* @author pthomas3
*/
public class DemoLogModifier implements HttpLogModifier {
public static final HttpLogModifier INSTANCE = new DemoLogModifier();
@Override
public boolean enableForUri(String uri) {
return uri.contains("/headers");
}
@Override
public String uri(String uri) {
return uri;
}
@Override
public String header(String header, String value) {
if (header.toLowerCase().contains("xss-protection")) {
return "***";
}
return value;
}
@Override
public String request(String uri, String request) {
return request;
}
@Override
public String response(String uri, String response) {
// you can use a regex and find and replace if needed
return "***";
}
}