All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.servicemesh.envoycontrol.config.envoy.HttpResponseCloser.kt Maven / Gradle / Ivy

There is a newer version: 0.22.4
Show newest version
package pl.allegro.tech.servicemesh.envoycontrol.config.envoy

import okhttp3.Response

object HttpResponseCloser {

    private val responses = mutableListOf()

    fun closeResponses() {
        responses.forEach(this::closeResponse)
        responses.clear()
    }

    private fun closeResponse(response: Response) {
        runCatching { response.close() }
    }

    fun Response.addToCloseableResponses() : Response {
        responses.add(this)
        return this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy