Skip to content

Commit d77c209

Browse files
committed
HTTP verifier clean-up
1 parent 3b7b1e1 commit d77c209

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

core/src/main/kotlin/org/evomaster/core/problem/security/verifiers/HttpCallbackVerifier.kt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.evomaster.core.problem.security.verifiers
22

33
import com.github.tomakehurst.wiremock.WireMockServer
4+
import com.github.tomakehurst.wiremock.client.MappingBuilder
45
import com.github.tomakehurst.wiremock.client.WireMock
56
import com.github.tomakehurst.wiremock.client.WireMock.aResponse
67
import com.github.tomakehurst.wiremock.client.WireMock.any
@@ -56,15 +57,7 @@ class HttpCallbackVerifier : VulnerabilityVerifier() {
5657

5758
wireMockServer = WireMockServer(config)
5859
wireMockServer!!.start()
59-
wireMockServer!!.stubFor(
60-
any(anyUrl())
61-
.atPriority(100)
62-
.willReturn(
63-
aResponse()
64-
.withStatus(418)
65-
.withBody("I'm a teapot")
66-
)
67-
)
60+
wireMockServer!!.stubFor(getDefaultStub())
6861
} catch (e: Exception) {
6962
throw RuntimeException(
7063
e.message +
@@ -138,8 +131,18 @@ class HttpCallbackVerifier : VulnerabilityVerifier() {
138131

139132
fun resetHTTPVerifier() {
140133
wireMockServer?.resetAll()
141-
// TODO: set default stub
134+
wireMockServer?.stubFor(getDefaultStub())
142135
traceTokens.clear()
143136
}
144137

138+
private fun getDefaultStub() : MappingBuilder {
139+
return any(anyUrl())
140+
.atPriority(100)
141+
.willReturn(
142+
aResponse()
143+
.withStatus(418)
144+
.withBody("I'm a teapot")
145+
)
146+
}
147+
145148
}

0 commit comments

Comments
 (0)