SpringCloud HTTP顶级元素
2023-12-12 18:04 更新
在合同定义的顶级闭合中可以调用以下方法。request
和response
是必需的。priority
是可选的。
Groovy DSL。
org.springframework.cloud.contract.spec.Contract.make { // Definition of HTTP request part of the contract // (this can be a valid request or invalid depending // on type of contract being specified). request { method GET() url "/foo" //... } // Definition of HTTP response part of the contract // (a service implementing this contract should respond // with following response after receiving request // specified in "request" part above). response { status 200 //... } // Contract priority, which can be used for overriding // contracts (1 is highest). Priority is optional. priority 1 }
YAML。
priority: 8 request: ... response: ...
如果要使合同具有较高的优先级,则需要将较低的数字传递给priority
标签/方法。例如,值5
的priority
的优先级高于值10
的priority
。更高比priority
与{值4141 /}优先级。
以上内容是否对您有帮助:
更多建议: