Conversation
| @@ -0,0 +1,18 @@ | |||
| package org.prebid.server.functional.model | |||
|
|
|||
| enum HttpStatusCode { | |||
There was a problem hiding this comment.
We can use org.apache.http.HttpStatus instead of our own codes
| wireMockClient.register(post(urlPathEqualTo(endpoint)) | ||
| .atPriority(Integer.MAX_VALUE) | ||
| .willReturn(aResponse() | ||
| .withTransformers("response-template") |
There was a problem hiding this comment.
we can add global-response-templating and remove this from all responses https://wiremock.org/docs/standalone/docker/#building-your-own-image
|
|
||
| private static final String rfcEndpoint= "/stored-requests-rfc" | ||
| private static final HttpSettings httpSettings = new HttpSettings(networkServiceContainer) | ||
| private static final HttpSettings httpSettingsWithRFC = new HttpSettings(networkServiceContainer, rfcEndpoint) |
There was a problem hiding this comment.
should be: httpSettingsWithRfc
https://google.github.io/styleguide/javaguide.html#s5.3-camel-case
|
|
||
| def cleanupSpec() { | ||
| bidder.reset() | ||
| prebidCache.reset() |
There was a problem hiding this comment.
Is there a reason to remove it?
| request().withMethod("GET") | ||
| .withPath(endpoint) | ||
| protected RequestPatternBuilder getRequest(String bidRequestId) { | ||
| return null |
There was a problem hiding this comment.
Returning null here and in similar methods is a bad practice. We should either refactor this logic or throw UnsupportedOperationException to avoid potential NPEs
| List<Map<String, List<String>>> result = [] | ||
| requests.each { req -> | ||
| Map<String, List<String>> headersMap = [:] | ||
| req.headers.all().each { header -> | ||
| headersMap[header.key() as String] = header.values()*.toString() | ||
| } | ||
| result << headersMap | ||
| } | ||
|
|
||
| result |
There was a problem hiding this comment.
can simplify:
List<Map<String, List<String>>> getRecordedRequestsHeaders(RequestPatternBuilder builder) {
wireMockClient.find(builder).collect { req ->
req.headers.all().collectEntries { [it.key(), it.values()*.toString()] }
}
}
| RequestPattern getRequest(String bidRequestId, String requestMatchPath) { | ||
| postRequestedFor(urlMatching("^$endpoint(\\?.*)?\$")) | ||
| .withRequestBody(matchingJsonPath("\$[?(@." + requestMatchPath + " == '" + bidRequestId + "')]")) | ||
| .build() |
There was a problem hiding this comment.
can be simplified:
RequestPattern getRequest(String bidRequestId, String requestMatchPath) {
postRequestedFor(urlMatching("^${endpoint}(\\?.*)?\$"))
.withRequestBody(matchingJsonPath("\$[?(@.${requestMatchPath} == '${bidRequestId}')]"))
.build()
}
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check