Skip to content

Commit 2ed1bf3

Browse files
Update Connekt examples
1 parent ede8e02 commit 2ed1bf3

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎connekt-script-definition/README.md‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,23 @@ POST("https://api.example.com/users") {
5757
### Handling Responses
5858

5959
```kotlin
60-
GET("https://api.example.com/users/1").then {
61-
val userData = jsonPath().json<Map<String, Any>>()
62-
assertEquals("John Doe", userData["name"])
60+
GET("https://api.example.com/users/1") then {
61+
val name = decode<String>("$.name")
62+
assertEquals("John Doe", name)
6363
}
6464
```
6565

6666
### Using Variables
6767

6868
```kotlin
69-
val userId by variable<String>()
70-
71-
POST("https://api.example.com/users") {
69+
val userId: String by POST("https://api.example.com/users") {
7270
contentType("application/json")
7371
body("""{"name": "John Doe"}""")
74-
}.then {
75-
userId.set(jsonPath().read("$.id"))
72+
} then {
73+
jsonPath().read("$.id")
7674
}
7775

78-
GET("https://api.example.com/users/${userId.get()}")
76+
GET("https://api.example.com/users/$userId")
7977
```
8078

8179
### Form Data

0 commit comments

Comments
 (0)