1"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[24935],{71071(e,t,n){n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"pact_broker/advanced_topics/api_docs/publish_pact","title":"Publishing pacts","description":"Allowed methods: PUT","source":"@site/docs/pact_broker/advanced_topics/api_docs/publish_pact.md","sourceDirName":"pact_broker/advanced_topics/api_docs","slug":"/pact_broker/advanced_topics/api_docs/publish_pact","permalink":"/pact_broker/advanced_topics/api_docs/publish_pact","draft":false,"unlisted":false,"editUrl":"https://github.com/pact-foundation/docs.pact.io/edit/master/website/docs/pact_broker/advanced_topics/api_docs/publish_pact.md","tags":[],"version":"current","lastUpdatedBy":"Elliott Murray","lastUpdatedAt":1597827488000,"frontMatter":{}}');var s=n(74848),r=n(28453);const i={},a="Publishing pacts",c={},p=[];function d(e){const t={code:"code",h1:"h1",header:"header",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.header,{children:(0,s.jsx)(t.h1,{id:"publishing-pacts",children:"Publishing pacts"})}),"\n",(0,s.jsx)(t.p,{children:"Allowed methods: PUT"}),"\n",(0,s.jsx)(t.p,{children:'A pact is published to the broker using a combination of the provider name, the consumer name, and the consumer application version. The consumer application version will be used to determine which revision of the pact is the "latest" to return to the provider for verification, and will allow you to determine which versions of the consumer and provider are compatible with each other.'}),"\n",(0,s.jsx)(t.p,{children:"The pact generated by your passing consumer tests should be published to the broker during each CI build. Tools exist for this exist in most languages that have an implementation of pact."}),"\n",(0,s.jsx)(t.p,{children:"Example:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-text",children:'PUT http://broker/pacts/provider/Bar/consumer/F
1oo/version/1.2.104\n\n{\n "consumer": {\n "name": "Bar"\n },\n "provider": {\n "name": "Foo"\n },\n "interactions": [\n {\n "description" : "a request for something",\n "provider_state": "something exists",\n "request": {\n "method": "get",\n "path" : "/something"\n },\n "response": {\n "status": 200,\n "body" : "something"\n }\n }\n ]\n}\n'})})]})}function h(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},28453(e,t,n){n.d(t,{R:()=>i,x:()=>a});var o=n(96540);const s={},r=o.createContext(s);function i(e){const t=o.useContext(r);return o.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.