简体   繁体   中英

Postman raw body response for 400

I am executing the postman post request. In bad request 400 response , In body section i see different messages based on execution.

  1. say when the access token expired, message shown in body is "unauthorzied token"

  2. when the existing template postcall is executed, it says view already exist.

  3. when we pass wrong filter param it says, incorrect filters.

I am looking to get this in reponse through java code. but when i get response.getmessage the only message i see is bad request. but i am looking to get the corresponding error response,

how i can achieve. any pointers would be helpful. Thankss

To get any response for my Spring-boot api's I return from the function an ResponseEntity (return ResponseEntity.status(HttpStatus.STATUSCODE).body(a json body)) to get the error. I usually don't see a response to spring-boot (java EE) bc for that I use Angular or js to catch the response. I found on Java Docs that there's a static method 'Response.status' ( https://docs.oracle.com/javaee/7/api/javax/ws/rs/core/Response.Status.html ) that maybe is what are u finding. I hope that was helpful.

I can't do more than that bc you don't show your code, sorry

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM