apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

Provide requests info in Curl format

Open diego-gomez-olvera opened this issue 1 year ago • 0 comments

Use case

Whenever there is an issue, LoggingInterceptor is a pretty useful tool to check the requests and responses, but in order to reproduce an issue, it would be best to have a Curl formatted instruction., something that can easily be shared with other developers.

Describe the solution you'd like

Currently for OkHttp a possibility is to use Ok2Curl:

private val client = ApolloClient.Builder()
.httpEngine(DefaultHttpEngine(
    OkHttpClient.Builder()
    .addInterceptor(CurlInterceptor(object : Logger {
        override fun log(message: String) {
            println("Ok2Curl: $message")
        }
    }, Configuration(
        delimiter = " \\\n"
    ))).build())
).build()

However this solution only works for Android/JVM. It would be interesting to know if implementing HttpInterceptor it would be possible to have a similar solution for all platforms.

diego-gomez-olvera avatar Apr 20 '23 12:04 diego-gomez-olvera