Skip to content

[http-client] ENH: Add response as() methods that return HttpResponse wrapping bean, list and stream #132

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

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

rbygrave
Copy link
Contributor

These allow access to the http status code and headers for success responses that we want as a bean, list of stream.

final HttpResponse<MyDto> response = client.request()
      .path("hello/saveform")
      .formParam("name", "Bax")
      .formParam("email", "Bax@foo.com")
      .POST()
      .as(MyDto.class);           <!-- HERE !!!

// access to status code and headers
int statusCode = response.statusCode();
HttpHeaders headers = response.headers();

// with body converted to the type we desire
MyDto body = response.body();

… wrapping bean, list and stream

These allow access to the http status code and headers for
success responses that we want as a bean, list of stream.
@rbygrave rbygrave self-assigned this Jan 17, 2023
@rbygrave rbygrave added this to the 1.23 milestone Jan 17, 2023
@rbygrave rbygrave merged commit 2219220 into master Jan 17, 2023
@rbygrave rbygrave deleted the feature/client-asResponsesWithHttpStatusAndHeaders branch January 17, 2023 02:21
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.

1 participant