https://kotlinlang.org logo
Title
v

Vsevolod Kaganovych

05/27/2022, 1:30 PM
Hey again. I have another issue:
HttpLoggingInterceptor
breaks the multipart request. If I don't add it, the request works. The exception is the same as here https://github.com/apollographql/apollo-kotlin/issues/2912, but I don't add 2 of them. I have my custom interceptor for authorization and logging. Any ideas?
b

bod

05/27/2022, 1:41 PM
Hello! With Multipart there is a risk that an interceptor (including the OkHttp one) consumes Uploads. We actually have a fix for that, but it's not yet released. I would be interested to know if using the snapshots fixes your issue. For your own logging interceptor, as long as you're not reading the body, you should be good (you can also have a look at our implementation for inspiration if you do need to read it)
v

Vsevolod Kaganovych

05/27/2022, 2:03 PM
Should it be like
com.apollographql.apollo3:apollo-runtime:3.3.0-SNAPSHOT
?
b

bod

05/27/2022, 2:07 PM
3.3.1-SNAPSHOT
(it's the latest release + 0.0.1 😅)
v

Vsevolod Kaganovych

05/27/2022, 2:08 PM
Yeah, sure) The plugin version should be updated as well?
b

bod

05/27/2022, 2:09 PM
yes, you need to use the same version everywhere
v

Vsevolod Kaganovych

05/27/2022, 2:18 PM
it cannot find the plugin snapshot version, but the library dependencies are fine.
Plugin [id: 'com.apollographql.apollo3', version: '3.3.1-SNAPSHOT'] was not found in any of the following sources:
b

bod

05/27/2022, 2:20 PM
oh yeah sorry the instructions are not thorough. For the plugin you need to add this to your root `settings.gradle.kts`:
pluginManagement {
    repositories {
         maven { 
    url = uri("<https://s01.oss.sonatype.org/content/repositories/snapshots/>")
  }
        gradlePluginPortal()
        mavenCentral()
    }
}
v

Vsevolod Kaganovych

05/27/2022, 2:28 PM
Is it okay that for multipart we don't have the logs now even with the interceptor?
b

bod

05/27/2022, 2:29 PM
you should still see the method and headers, but not the body 🤔
v

Vsevolod Kaganovych

05/27/2022, 2:30 PM
Yeah, this is what I'm talking about. It would be nice to see the sent parameters at least to verify if they're valid. The encoded string is not needed, I guess.
But it's just a suggestion
b

bod

05/27/2022, 2:32 PM
oh ok. Well basically, OkHttp's logging interceptor doesn't have knowledge of multipart, to it, it's only a bunch of bytes. With the fix, it simply knows to not read it, because we set a special flag "is one shot" when using it.
v

Vsevolod Kaganovych

05/27/2022, 2:33 PM
Got it. Anyway, thanks for your help. Really appreciate it)
b

bod

05/27/2022, 2:33 PM
my pleasure! 🙂