Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TqRestClient flag for allowing self signed certs
It's a common thing especially in enterprise code to communicate with servers that are self-signed. You do still trust the server in question but you don't wish to completely ignore all certificate checking across all of the url connections. Thus this feature was added to allow for improved usability of restful connections without exposing security concerns across an application. Also upgraded various dependencies to the latest.
- Loading branch information
Showing
3 changed files
with
57 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
version=0.9.3-SNAPSHOT | ||
kotlin_version=1.2.40 | ||
jackson_version=2.9.5 | ||
kotlin_version=1.2.61 | ||
jackson_version=2.9.6 | ||
junit_version=4.12 | ||
spark_version=2.7.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tekniq-sparklin/src/test/kotlin/io/tekniq/rest/TqRestClientTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.tekniq.rest | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Assert.fail | ||
import org.junit.Test | ||
|
||
class TqRestClientTest { | ||
@Test | ||
fun get() { | ||
val client = TqRestClient() | ||
client.get("https://www.google.com") { | ||
assertEquals(200, status) | ||
} | ||
} | ||
|
||
@Test | ||
fun failOnInsecureSite() { | ||
val client = TqRestClient() | ||
client.get("https://216.58.210.164/finance") { | ||
assertEquals(-1, status) | ||
} | ||
} | ||
|
||
@Test | ||
fun getFailsonInsecureSiteDueToPreviousCallDisablingSecurity() { | ||
failOnInsecureSite() | ||
} | ||
} |