Spring Cloud Contract和Zuul

时间:2017-05-01 22:38:20

标签: spring-cloud spring-cloud-netflix spring-cloud-contract

使用Spring Cloud Dalston,我们已经构建了一个代理服务,当然,它使用Zuul。我现在正在尝试添加Spring Cloud Contract测试,以验证我们的代理服务是否符合合同规定的预期。奇怪的是,我可以发送请求并收回200状态代码,但预期的响应正文,内容类型标题等是空的,结果我的测试失败。

测试使用Zuul功能的服务是否需要Spring Cloud Contract文档中未指定的其他配置?

1 个答案:

答案 0 :(得分:0)

这里有一个示例https://github.com/spring-cloud/spring-cloud-contract/issues/450

{"success":1,"marks":[{"std_Name":"VIVEK SANAPARA","Standard":"12-SCI-CE","Division":"A","ExamDate":{"date":"2016-10-06 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"subject":"MATHS","ExamName":"WT","Marks":"30.00","TotalMarks":"30.00","PassingMarks":"10"},{"std_Name":"VIVEK SANAPARA","Standard":"12-SCI-CE","Division":"A","ExamDate":{"date":"2016-10-07 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Kolkata"},"subject":"PHYSICS","ExamName":"WT","Marks":"15.00","TotalMarks":"30.00","PassingMarks":"10"},{"std_Name":"VIVEK SANAPARA","Standard":"12-SCI-CE","Division":"A","ExamDate":{"date":"2016-10-08 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Kolkata"},"subject":"PHYSICS","ExamName":"WT","Marks":"25.00","TotalMarks":"30.00","PassingMarks":"10"},{"std_Name":"VIVEK SANAPARA","Standard":"12-SCI-CE","Division":"A","ExamDate":{"date":"2016-11-22 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Kolkata"},"subject":"PHYSICS","ExamName":"WT","Marks":"25.00","TotalMarks":"30.00","PassingMarks":"10"},],"total":[{"Marks":"30.00","TotalMarks":"30.00","Percentage":"79.166600"}],"exam":[{"ExamName":"WT"}]}