1, pom文件引入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
2,写测试类
@FeignClient(name = "ddd",url = "https://blog.csdn.net/")
public interface Testccc {
@RequestMapping(method = RequestMethod.GET, value ="/phoenix/web/v1/isCollect")
public String testtt(@SpringQueryMap JSONObject jsonObject, @RequestHeader Map map);
}
3,进行测试
@RestController
@RequestMapping("/testFeign")
public class TestFeigGet {
@GetMapping("/ttttt")
public void ttttt(){
String ddd="positions=536,603,604,605,606,607";
JSONObject jsonObject = new JSONObject();
jsonObject.put("articleId","88535821");
Map<String, Object> map = new HashMap<>();
map.put("cookie","写你自己的请求头cookie");
String testtt = testccc.testtt(jsonObject,map);
System.out.println(testtt);
}
}
然后调一下就ok了
看一下返回结果
{"code":200,"message":"success","data":{"tips":"未收藏","status":false}}