Comments (12)
I don’t believe the behavior has changed in OkHttp 4.12.0.
We’ve got a test case in 4.12.0 that hasn’t changed since December 8, 2019.
https://github.com/square/okhttp/blob/okhttp_4x/okhttp/src/test/java/okhttp3/FormBodyTest.java#L26
But we did change it in 5.0.0-alpha.2, and I announced that in our changelog:
https://github.com/square/okhttp/pull/6518/files
https://square.github.io/okhttp/changelogs/changelog/#version-500-alpha2
Is it possible you’re running the 5.0 release unexpectedly, perhaps via a transitive dependency?
Either way I’m sorry for the disruption, and we don’t make breaking changes lightly.
from okhttp.
It appears we mixed mockwebserver alpha 5 with okhttp 4.12.0.
Oddly, it works, but we'd prefer to use com.squareup.okhttp3:mockwebserver:4.12.0.
But when we try to do that, there's no okhttp3.mockwebserver.MockWebServerExtension.
Is there some other non-5/non-alpha jar we need to add to get the equivalent of a JUnit 5 extension class for mockwebserver 4.12.0?
from okhttp.
We'd love to use your v5 alpha jars, but we have to keep dependencies aligned with the latest Spring and Spring Boot, and they're on 4.12.0.
from okhttp.
One of the main goals of OkHttp 5.x is to fix our longstanding bug where MockWebServer is strongly coupled with JUnit 4.
from okhttp.
I’ll do what I can to get 5.0 final out soon, which will hopefully be taken up quickly by our Spring friends.
from okhttp.
Is there some way to use mockwebserver alpha 5 without changing the form body?
from okhttp.
Could you please elaborate on the problem with the new behaviour? According to the PR that changed it, the new behaviour is closer to what the specs expect.
from okhttp.
In version 4.12.0, there was a change in form body encoding where spaces are now represented as %20 instead of the plus sign (+). Check the release notes or documentation for details, and update your code accordingly for compatibility.
from okhttp.
@RonakWithCode there was no such behaviour change in 4.12. Please see the comment above.
from okhttp.
The mystery is that:
- We're on 4.12.0 for everything except mockwebserver.
- We have Gradle forces for okhttp, and they work even for mockwebserver, as shown in the output from gradlew dependencies:
--- com.squareup.okhttp3:mockwebserver3-junit5:5.0.0-alpha.2
+--- com.squareup.okhttp3:mockwebserver3:5.0.0-alpha.2
| +--- com.squareup.okhttp3:okhttp:5.0.0-alpha.2 -> 4.12.0
- The behavior of our form-body test changed from + to %20.
- Our form-body test doesn't even use mockwebserver:
package com.foo;
import jakarta.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.internal.Util;
public abstract class FooRequestBody {...
package com.foo;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import okhttp3.FormBody;
public class FooFormBody extends FooRequestBody {...
package com.foo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import okio.Buffer;
import org.junit.jupiter.api.Test;
class FooFormBodyTest {
private FooFormBody body;
from okhttp.
Can you reproduce in a minimal build with only 4.12.0?
Otherwise it points to an issue with your gradle build still lying about the version.
from okhttp.
Closing for now as we have tests for this, will reopen if we can repro it failing on 4.12.0
from okhttp.
Related Issues (20)
- Ensure builds run with a specific JVM version HOT 3
- Switch MockWebServer extension to use Named
- Unknown enum constant DeprecationLevel HOT 8
- OkHttp periodically error No address associated with hostname HOT 17
- callTimeout appears to not be enforced when RequestBody.isDuplex is true HOT 3
- Expose SSE retry time updates via the public API HOT 2
- Not working with AGP 8.2.1 HOT 2
- Flaky HttpOverHttp2Test HOT 3
- All cacheKey override on Request. HOT 19
- Why there is no 4.11.0 release branch? HOT 3
- Crash unable to load publicsuffixes.gz resource from the classpath. HOT 1
- Why wildcard like "*.example.com" of hosts is used in Certificate Pinning HOT 2
- Certificate Pinning disable opportunity. HOT 1
- toCanonicalHost() HOT 11
- API suggestion: `buildMockResponse { }` HOT 2
- Fix HttpOverHttp2Test flakes and bad cache behaviour HOT 1
- Should SSLContext construction be deferred during OkHttpClient construction HOT 2
- Unexpected random crashes with java.lang.IllegalStateException: Unbalanced enter/exit HOT 8
- HTTPS request throught Proxy not working (but working fine with java.net) HOT 10
- Flaky test report
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okhttp.