Closed someshrathi02 closed 4 years ago
@graemerocher - May i request if this issue can be validated by micronaut team ? That will be really helpful.
@graemerocher /Micronaut team - Your help/advise will be very helpful on this issue. Im facing above issue in project and we are trying to migrate from micronaut 1.3.6 to 2.0.0 and because of this not able to proceed further.
Currently away, will look at this when I get back next week unless @jameskleeh or someone else gets to it first
@graemerocher / @ilopmar Any updates on this please .
Thanks @jameskleeh and @graemerocher for looking into this issue and providing the solution. When this fix will be available for me to test ? I think its tagged to 2.0.2. , before that can i get some tag/branch release which I can test locally to see if it fixes my issue.
@someshrathi02 You can use the 2.0.2.BUILD-SNAPSHOT build
Thank you so much @jameskleeh. for providing the solution. I tried with 2.0.2.BUILD-SNAPSHOT and its working now. Thank you for working on it and providing an enhancement. Appreciate your time and attention on it.
How to return only the body from HttpResponse while upgrading from Micronaut 1.3.6 to 2.0.0
Task List
Steps to Reproduce
Run the example Application from the https://github.com/someshrathi02/micronaut_http_client ( Sample example created using guide provided https://guides.micronaut.io/micronaut-http-client-kotlin/guide/index.html )
Expected Behaviour
In Micronaut 1.3.6 , when declarative client returns Single<HttpResponse<List>> , REST Api's (defined in controller ) response only contains the json (as per below json ) which contains bintray api response.
So same is expected when upgraded to 2.0.0 , i.e.
Actual Behaviour
After upgrading to micronaut 2.0.0 , i'm getting json response from service as below , which contains the 'status' , 'headers', 'body','nativeResponse' etc
Environment Information
Example Application
link to github repository with example that reproduces the issue as below https://github.com/someshrathi02/micronaut_http_client
Issue summary
In Micronaut 1.3.6 , currently service response (i.e. HttpResponse) only contains the contents of the body key.
After upgrading to micronaut 2.0.0 , i'm getting json response from service as below , which contains the 'status' , 'headers', 'body','nativeResponse' etc.
I can get the body from response
using the rxjava map operator - just get the body key from complete Http Response
Change the signature of Declarative Http client to return Single instead of Single<HttpResponse
However this need lot of refactoring in existing all the services implemented + unit test. Hence is there any easy option to just return the content of HttpResponse.body as json ? Are there any configurations which can be enabled/changed **
After upgrading to 2.0.0 , response from service as below
I'm using controller and Declarative http client as below :