Nani
Nani

Reputation: 75

Issue with RestTemplate exchange method after Spring Boot Upgrade - Throwing Bad Request Error on calls

After upgrading to springboot 3.1 from 2.7, We are facing 400 bad request error on RestTemplate calls. The api we built internally makes Https call and during this call we are seeing the issue. This behavior was not present in the old version and it is linked to springboot upgrade changes.

Error:

HTTP Error Message: 
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>400 Bad Request</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Bad Request</h1>
<h2>Your client has issued a malformed or illegal request.</h2>
<h2></h2>
</body></html>
] with root cause
org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "<EOL><html><head><EOL><meta http-equiv="content-type" content="text/html;charset=utf-8"><EOL><title>400 Bad Request</title><EOL></head><EOL><body text=#000000 bgcolor=#ffffff><EOL><h1>Error: Bad Request</h1><EOL><h2>Your client has issued a malformed or illegal request.</h2><EOL><h2></h2><EOL></body></html><EOL>"

Issue was referenced here, but donot see any solution: https://github.com/spring-projects/spring-boot/issues/39067

Upvotes: 0

Views: 311

Answers (1)

The_IT_Girl
The_IT_Girl

Reputation: 1

Could you please re-check if content-type is set correctly in request and the same is being consumed at the server.

Upvotes: 0

Related Questions