Closed sgpublic closed 1 year ago
The annotation @RequestBody
will serialize the object to json
or xml
, but consumes
specifies the format as application/x-www-form-urlencoded
, which causes the body in the request sent by Feign to be empty, so the microsoft server returns a 404 Not Found
response.
To solve this problem, the @RequestBody
annotation should be removed:
@PostMapping(value = "/common/oauth2/v2.0/devicecode", consumes = "application/x-www-form-urlencoded")
Map<String, Object> getDeviceCode(Request dto);
Looks like you figured it out. 👍🏻
Hello, I have some questions about using Feign in Spring Cloud. I have a FeignClient:
But when I call function
DeviceCodeCheckClient#getTokenByDeviceCode
, it throwfeign.FeignException$NotFound
:Obviously, the link
https://login.microsoftonline.com/common/oauth2/v2.0/devicecode
is correct and accessible. I would like to know why Feign is giving error 404 and how can I fix this? Thank you!