Skip to content

Commit 11d8b68

Browse files
committed
Highlight header or body
1 parent a341f62 commit 11d8b68

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/main/kotlin/ReflectHighlight.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ import org.parosproxy.paros.network.HttpMessage
44
import org.parosproxy.paros.view.View
55
import org.zaproxy.zap.extension.search.SearchMatch
66

7-
class ReflectHighlight(private val reqRes: HttpMessage, private val tokens: List<String>) {
7+
class ReflectHighlight(
8+
private val reqRes: HttpMessage,
9+
private val headerTokens: List<String>,
10+
private val bodyTokens: List<String>
11+
) {
812

9-
private val searchMatch: SearchMatch? by lazy {
10-
searchMatcher(tokens)
13+
private val searchMatch: Pair<SearchMatch?, SearchMatch?> by lazy {
14+
Pair(searchMatcher(headerTokens), searchMatcher(bodyTokens))
1115
}
1216

1317
fun highlight() {
14-
searchMatch?.let {
15-
View.getSingleton().responsePanel.highlightBody(it)
18+
if (searchMatch.second != null) {
19+
View.getSingleton().responsePanel.highlightBody(searchMatch.second)
20+
} else if (searchMatch.first != null) {
21+
View.getSingleton().responsePanel.highlightHeader(searchMatch.first)
1622
}
1723
}
1824

0 commit comments

Comments
 (0)