Skip to content

Commit

Permalink
fix: Use okhttp5.0.0-alpha.1 for react-native-background-upload
Browse files Browse the repository at this point in the history
We have an http2 issue when uploading a file to a cozy when we reach the
quota limit. In that case, the stack closes the connexion but it can
appears after having already send a few bytes. In that case, okhttp was
not returning the right headers and we ended up with a:
`stream closed: cancel`.

With this version, okhttp is returning the right header!

see the okhttp changelog:
https://github.com/square/okhttp/blob/master/CHANGELOG.md#version-500-alpha1
specially:
`Fix: Attempt to read the response body even if the server canceled the
request. This will cause some calls to return nice error codes like
 HTTP/1.1 429 Too Many Requests instead of transport errors like
SocketException: Connection reset and StreamResetException: stream was
reset: CANCEL.
`
  • Loading branch information
Crash-- committed Aug 1, 2023
1 parent c4aa505 commit d0cfea6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ dependencies {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
implementation(project(":react-native-background-upload")) {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.1'
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.squareup.okhttp3' && details.requested.name == 'okhttp') {
if (details.requested.name == 'net.gotev:uploadservice-okhttp') {
details.useVersion 'com.squareup.okhttp3:okhttp:5.0.0-alpha.1'
}
}
}
}
}

// Run this once to be able to run the application with BUCK
Expand Down

0 comments on commit d0cfea6

Please sign in to comment.