400 error in Spring Cloud Feign interface call

There may be many cases of 400 errors in the Feign interface call. Let me talk about my 400 errors.

400 error reason:

When the Feign consumer calls the consumer interface, the incoming parameter is null, resulting in a 400 error.

Before the error is reported:

//Feign消费者
@RequestMapping("/test")
public void test(String testStr){
}

After handling the error:

//Feign消费者
@RequestMapping("/test")
public void test(String testStr){
    testStr=testStr==null?"":testStr;
}

 

Published 34 original articles · received 1 · views 1946

Guess you like

Origin blog.csdn.net/qq_38974638/article/details/104773650
Recommended