How to get HttpClient returning status code and response body?

后端 未结 5 2093
谎友^
谎友^ 2020-11-29 08:03

I am trying to get Apache HttpClient to fire an HTTP request, and then display the HTTP response code (200, 404, 500, etc.) as well as the HTTP response body (text string).

5条回答
  •  旧时难觅i
    2020-11-29 08:36

    If you are using Spring

    return new ResponseEntity("your response", HttpStatus.ACCEPTED);
    

提交回复
热议问题