Skip to content

Conversation

@mohan-13
Copy link
Member

@mohan-13 mohan-13 commented Nov 1, 2025

This PR adds support for POST method in web-clients. The post takes in a payload of any type T and parses the response in the requested format passed as returnType R.

  • Minor refactoring has been carried out to reduce duplicates

JIRA: https://bahmni.atlassian.net/browse/BAH-4237


private String post(URI uri, String body, HttpHeaders httpHeaders) {
try {
HttpResponse httpResponse = httpClientInternal.post(authenticator.getRequestDetails(uri), body, httpHeaders);
Copy link
Member

Choose a reason for hiding this comment

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

how about using try with resources instead of try - catch - finally. Check HttpResponse implements Closeable?

Copy link
Member Author

Choose a reason for hiding this comment

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

HttpResponse is not closeable.
There is a ClosableHttpClient used by the HttpClientInternal which can be implemented for try with resources. We can improve that later on.

@mohan-13 mohan-13 merged commit 7100919 into master Nov 11, 2025
2 checks passed
@mohan-13 mohan-13 deleted the BAH-4237 branch November 11, 2025 04:24
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