-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure-Core Migration Recipes #44494
base: main
Are you sure you want to change the base?
Azure-Core Migration Recipes #44494
Conversation
In progress
In progress
…' into openrewrite/azure-core-migration
API change check APIView has identified API level changes in this PR and created following API reviews. |
|
||
public class HttpRequestExample { | ||
public static void main(String... args) { | ||
HttpClient client = new JdkHttpClientBuilder().build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't right - we shouldn't be changing the customer code from using Netty to using JdkHttpClient
try { | ||
Response response = client.send(request); | ||
System.out.println("Status code: " + response.getStatusCode()); | ||
} catch (IOException e) { | ||
System.err.println("Error occurred: " + e.getMessage()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the try / catch required in vNext?
HttpHeaders headers = new HttpHeaders(); | ||
headers.add(HttpHeaderName.CONTENT_TYPE, "multipart/form-data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should follow the same pattern as before - HttpHeaders headers = new HttpHeaders().set("Content-Type", "multipart/form-data");
String jsonBody = "{\"key\":\"value\"}"; | ||
HttpRequest request = new HttpRequest(HttpMethod.PUT, "https://example.com", headers, jsonBody); | ||
|
||
HttpResponse response = client.send(request).block(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These samples are using the async pipeline and blocking. You'll want to make sure you also support the scenario where the sync pipeline was used.
This PR contains the migration recipes and test for the migration of azure-core to clientcore and azure-core-v2.