Skip to content

Commit

Permalink
feat: Move header support up to RequestHeaderSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
telenorpronstad committed Mar 22, 2024
1 parent 9b9264e commit 8cb9d00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/no/telenor/kt/restclient/util/util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ fun RequestBodySpec.json(value: Any) = this
.body(value)
.contentType(MediaType.APPLICATION_JSON)!!

fun RequestBodySpec.header(header: String, value: Any) : RequestBodySpec = this
fun RequestHeadersSpec<*>.header(header: String, value: Any) : RequestHeadersSpec<*> = this
.header(header, value.toString())

fun RequestBodySpec.headers(vararg headersWithValue: Pair<String, Any>) : RequestBodySpec = this
fun RequestHeadersSpec<*>.headers(vararg headersWithValue: Pair<String, Any>) : RequestHeadersSpec<*> = this
.headers { httpHeaders -> headersWithValue.forEach { httpHeaders.add(it.first, it.second.toString()) }}

// --- response body utility ---
Expand Down

0 comments on commit 8cb9d00

Please sign in to comment.