1

I am making a simple Rest call as below with no headers in java. But I get this exception message: Could not extract response: no suitable HttpMessageConverter found for response type [class com.things.customer.xcitycustomers.responsemodel.CustomerDetailsGrp1Request] and content type [application/octet-stream]\n\tat

ResponseEntity<CustomerDetailsGrp1Request> response
                = restTemplate.getForEntity("http://localhost:8089/mock/group1", CustomerDetailsGrp1Request.class, HttpStatus.OK);

I am not sure how/why is content type of application/octet-stream is being passed. I tried adding content type as application/json in postman header and in request entity too but it doesnot help. Also tried adding @bean to enable all content type but did not work either. Any help please! Thanks in advance

  • Does this answer your question? [RestClientException: Could not extract response. no suitable HttpMessageConverter found](https://stackoverflow.com/questions/44176335/restclientexception-could-not-extract-response-no-suitable-httpmessageconverte) – mentallurg May 01 '22 at 00:50

1 Answers1

3

My solution was: In the mocker server I have not specified the content type, so it was giving me octatte-stream. Once I mentioned the content type as :

 "response": {
    "status": 200,
    "bodyFileName": "../__files/get_users_response.json",
    "headers": {
      "Content-Type": "application/json"
    }
  }

Bingo! It is working.