Convert String to HTTPEntity

1.3k Views Asked by At

I am getting api response as String. eg:

HTTP/2 201 
server: nginx/1.14.0 (Ubuntu)
date: Fri, 23 Oct 2020 11:35:08 GMT
content-type: application/json
content-length: 51
set-cookie: userid=test; Path=/
set-cookie: uid=98-123-8h6; Path=/
set-cookie: session=hjdvcbdvbsdbuvibvbbubevbewuivbouewvjbivbivbweiubvuiebwviubewviubevwibewiuvbivebvbveb; Expires=Fri, 12-Dec-2020 11:45:08 GMT; HttpOnly; Path=/

{
  "message": "Login successful"
}

I need to convert this string to HttpEntity in java so that i can use entity.getBody to access the body and status code.

0

There are 0 best solutions below