Skip to content

Commit 1a1eb14

Browse files
committed
- Upgrade Deps
- insecureApacheHttpClient() Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 6487ebe commit 1a1eb14

File tree

5 files changed

+34
-13
lines changed

5 files changed

+34
-13
lines changed

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ image:pq-exe-logging.gif[Monitor Execution]
375375
=== Type Safety with flexible JSON <- -> POJO marshalling/serialization and unmarshalling/deserialization
376376

377377
* ReṼoman internally uses a modern JSON library called https://github.com/square/moshi[**Moshi**]
378-
* There may be a POJO that inherits or contains legacy types that are hard or impossible to serialize. ReṼoman lets you serialize such types through `globalSkipTypes`, where you can filter out these legacy types from Marshalling/Unmarshalling, only focussing on fields that matter.
379-
* The payload may not map to POJO, and you may need a custom types adapter for Marshalling/Unmarshalling. Moshi has it covered for you with its advanced adapter mechanism and ReṼoman accepts Moshi adapters via
378+
* There may be a POJO that inherits or contains legacy types that are hard or impossible to serialize. ReṼoman lets you serialize only types that matter, through `globalSkipTypes`, where you can filter out these legacy types from Marshalling/Unmarshalling
379+
* The JSON structure may not align with the POJO, and you may need a _Custom Type Adapter_ for Marshalling/Unmarshalling. Moshi has it covered for you with its advanced adapter mechanism and ReṼoman accepts Moshi adapters via:
380380
** `requestConfig` — For types present as part of request payload for qualified Steps
381381
** `responseConfig` — For types present as part of response payload for qualified Steps
382382
** `globalCustomTypeAdapters` — For types present as part of request payload anywhere
@@ -387,7 +387,7 @@ for an advanced adapter use-case
387387

388388
==== JSON POJO Utils
389389

390-
link:{sourcedir}/com/salesforce/revoman/input/json/JsonPojoUtils.kt[JSON POJO Utils] can be used to directly convert JSON to POJO and vice versa.
390+
The bundled link:{sourcedir}/com/salesforce/revoman/input/json/JsonPojoUtils.kt[JSON POJO Utils] can be used to directly convert JSON to POJO and vice versa.
391391

392392
[TIP]
393393
====
@@ -409,7 +409,7 @@ The configuration offers methods through which the execution strategy can be con
409409
[#_pre_step_and_post_step_hooks]
410410
=== Pre-Step and Post-Step Hooks
411411

412-
A hook lets you fiddle with the execution by plugging in your custom code before or after a Step execution.
412+
A hook lets you fiddle with the execution by plugging in your custom JVM code before or after a Step execution.
413413

414414
[#_step_picks]
415415
You can pass a `PreTxnStepPick/PostTxnStepPick` which is a `Predicate` used
@@ -483,7 +483,7 @@ npm install moment
483483
.Use inside pre-req and post-res scripts
484484
[source,javascript,indent=0,options="nowrap"]
485485
----
486-
var moment = require("moment")
486+
var moment = require("moment")
487487
var _ = require('lodash')
488488
489489
pm.environment.set("$currentDate", moment().format(("YYYY-MM-DD")))

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/kotlin/com/salesforce/revoman/internal/exe/HttpRequest.kt

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ import com.salesforce.revoman.output.ExeType.HTTP_REQUEST
1313
import com.salesforce.revoman.output.report.Step
1414
import com.salesforce.revoman.output.report.TxnInfo
1515
import com.salesforce.revoman.output.report.failure.RequestFailure.HttpRequestFailure
16+
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient
17+
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder
18+
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager
19+
import org.apache.hc.client5.http.socket.ConnectionSocketFactory
20+
import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory.INSTANCE
21+
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory
22+
import org.apache.hc.core5.http.config.RegistryBuilder
23+
import org.apache.hc.core5.ssl.SSLContextBuilder
1624
import org.http4k.client.ApacheClient
17-
import org.http4k.client.PreCannedApacheHttpClients.insecureApacheHttpClient
1825
import org.http4k.core.Filter
1926
import org.http4k.core.HttpHandler
2027
import org.http4k.core.NoOp
@@ -42,7 +49,22 @@ internal fun fireHttpRequest(
4249
private fun prepareHttpClient(bearerToken: String?, insecureHttp: Boolean): HttpHandler =
4350
DebuggingFilters.PrintRequestAndResponse()
4451
.then(if (bearerToken.isNullOrEmpty()) Filter.NoOp else ClientFilters.BearerAuth(bearerToken))
45-
.then(
46-
if (insecureHttp) ApacheClient(client = insecureApacheHttpClient())
47-
else ApacheClient()
48-
)
52+
.then(if (insecureHttp) ApacheClient(client = insecureApacheHttpClient()) else ApacheClient())
53+
54+
/** Only for Testing. DO NOT USE IN PROD */
55+
fun insecureApacheHttpClient(): CloseableHttpClient =
56+
SSLContextBuilder()
57+
.loadTrustMaterial(null) { _, _ -> true }
58+
.build()
59+
.run {
60+
HttpClientBuilder.create()
61+
.setConnectionManager(
62+
PoolingHttpClientConnectionManager(
63+
RegistryBuilder.create<ConnectionSocketFactory>()
64+
.register("http", INSTANCE)
65+
.register("https", SSLConnectionSocketFactory(this) { _, _ -> true })
66+
.build()
67+
)
68+
)
69+
.build()
70+
}

src/main/kotlin/com/salesforce/revoman/internal/postman/template/Template.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package com.salesforce.revoman.internal.postman.template
99

1010
import com.salesforce.revoman.internal.postman.PostmanSDK
1111
import com.squareup.moshi.JsonClass
12-
import org.http4k.core.ContentType
1312
import org.http4k.core.ContentType.Companion.APPLICATION_JSON
1413
import org.http4k.core.ContentType.Companion.Text
1514
import org.http4k.core.Method

0 commit comments

Comments
 (0)