-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad6542b
commit c5171e2
Showing
1 changed file
with
31 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ import io.ktor.client.plugins.* | |
import kotlinx.coroutines.* | ||
import kotlinx.serialization.json.JsonPrimitive | ||
import java.time.Instant | ||
import java.util.* | ||
|
||
fun main() { | ||
val httpClient = HttpClient() { | ||
|
@@ -84,6 +85,35 @@ fun main() { | |
expect(tag, result.string, "hello world") | ||
} | ||
|
||
runBlocking { | ||
val tag = "SEND/RECEIVE OBJECT WITH SNAKE_CASE KEYS" | ||
val input = ObjectWithSnakeCaseKeys( | ||
createdAt = targetDate, | ||
displayName = "john doe", | ||
phoneNumber = null, | ||
emailAddress = "[email protected]", | ||
isAdmin = null | ||
) | ||
val result = client.tests.sendObjectWithSnakeCaseKeys(input) | ||
expect(tag, result, input) | ||
} | ||
|
||
runBlocking { | ||
val tag = "SEND/RECEIVE OBJECT WITH PASCAL CASE KEYS" | ||
var input = ObjectWithPascalCaseKeys( | ||
createdAt = targetDate, | ||
displayName = "john doe", | ||
phoneNumber = "211-211-2111", | ||
emailAddress = null, | ||
isAdmin = true | ||
) | ||
val result = client.tests.sendObjectWithPascalCaseKeys(input) | ||
expect(tag, result, input) | ||
input = input.copy(isAdmin = null) | ||
val result2 = client.tests.sendObjectWithPascalCaseKeys(input) | ||
expect(tag, result2, input) | ||
} | ||
|
||
runBlocking { | ||
val tag = "UNAUTHENTICATED REQUEST RETURNS ERROR" | ||
try { | ||
|
@@ -434,7 +464,7 @@ fun testSseReconnectsWithNewCredentials(httpClient: HttpClient, baseUrl: String) | |
httpClient = httpClient, | ||
baseUrl = baseUrl, | ||
headers = { | ||
val newHeader = "kt_${java.util.UUID.randomUUID().toString()}" | ||
val newHeader = "kt_${UUID.randomUUID().toString()}" | ||
headers.add(newHeader) | ||
mutableMapOf(Pair("x-test-header", newHeader)) | ||
} | ||
|