File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
core/src/main/kotlin/org/evomaster/core/problem/security/verifiers Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 1
1
package org.evomaster.core.problem.security.verifiers
2
2
3
3
import com.github.tomakehurst.wiremock.WireMockServer
4
+ import com.github.tomakehurst.wiremock.client.MappingBuilder
4
5
import com.github.tomakehurst.wiremock.client.WireMock
5
6
import com.github.tomakehurst.wiremock.client.WireMock.aResponse
6
7
import com.github.tomakehurst.wiremock.client.WireMock.any
@@ -56,15 +57,7 @@ class HttpCallbackVerifier : VulnerabilityVerifier() {
56
57
57
58
wireMockServer = WireMockServer (config)
58
59
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())
68
61
} catch (e: Exception ) {
69
62
throw RuntimeException (
70
63
e.message +
@@ -138,8 +131,18 @@ class HttpCallbackVerifier : VulnerabilityVerifier() {
138
131
139
132
fun resetHTTPVerifier () {
140
133
wireMockServer?.resetAll()
141
- // TODO: set default stub
134
+ wireMockServer?.stubFor(getDefaultStub())
142
135
traceTokens.clear()
143
136
}
144
137
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
+
145
148
}
You can’t perform that action at this time.
0 commit comments