Skip to content
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

Add http byte[] aggregated example #2371

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

Scottmitch
Copy link
Member

Motivation:
Some times folks want to get the payload body as a byte[] and ByteArraySerializer can be used for this.

Motivation:
Some times folks want to get the payload body as a `byte[]` and
`ByteArraySerializer` can be used for this.
try (BlockingHttpClient client = HttpClients.forSingleAddress("localhost", 8080).buildBlocking()) {
HttpResponse resp = client.request(client.get("/bytes"));
System.out.println(resp.toString((name, value) -> value));
final byte[] bytes = resp.payloadBody(SERIALIZER); // Deserialize the whole payload body as a byte[].
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanted to give some usage of ByteArraySerializer ... as converting to byte[] may not be obvious for folks.

@Scottmitch Scottmitch merged commit 438892b into apple:main Sep 29, 2022
@Scottmitch Scottmitch deleted the bytes_serializer branch September 29, 2022 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants