Unirest 4.x
yeikel opened this issue · comments
Yeikel commented
What problem are you trying to solve?
Starting with Unirest 4.x, there were a couple of breaking changes that need manual intervention:
- The core Unirest package has been moved from kong.unirest to kong.unirest.core, this prevents classloader issues where Unirest 4 may conflict with previous versions which may also be on the classpath.
- Unirest no longer comes with GSON as a default JSON parser. In order to enable JSON support you must include either the GSON or Jackson JSON
What precondition(s) should be checked before applying this recipe?
- The project uses Unirest-java
- The project is using at least Java 11
Examples :
diff --git a/pom.xml b/pom.xml
index aa3b42f..ea24a72 100644
--- a/pom.xml
+++ b/pom.xml
<dependencies>
@@ -43,8 +44,7 @@
<dependency>
<groupId>com.konghq</groupId>
- <artifactId>unirest-java</artifactId>
- <version>3.14.5</version>
+ <artifactId>unirest-java-core</artifactId>
+ <version>4.2.7</version>
</dependency>
-import kong.unirest.RequestBodyEntity;
-import kong.unirest.Unirest;
+import kong.unirest.core.RequestBodyEntity;
+import kong.unirest.core.Unirest;
import kong.unirest.jackson.JacksonObjectMapper;
Any additional context
https://github.com/Kong/unirest-java/blob/main/UPGRADE_GUIDE.md
Tim te Beek commented
Thanks for the suggestion @yeikel ; perhaps we should create a rewrite-unirest once someone starts this recipe implementation.