Skip to content

How to open http logging? #154

Answered by christian-draeger
chachako asked this question in Q&A
Discussion options

You must be logged in to vote

hey,
with kotlin you can do even better. no need to writing a decorator like in java.
if understood correct you want to do something with the instantiated request object.
to do so you can just use kotlin build-in scope function called also to execute an additional effect on somerthing. (have a look here for more info).

that means you could just do something like this while using skrape{it} library:

fun main() {
    val responseBody = skrape(HttpFetcher) {
        request {
            url = "https://mvnrepository.com/artifact/kotlin"
            also {
                // the instantiated request object will be available as an implicit receiver / variable called `it` inside of the  also la…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by christian-draeger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #152 on June 29, 2021 20:51.