无法在pact代理中使用pact-jvm-provider-maven_2.11验证https端点

时间:2017-11-06 09:28:49

标签: pact-jvm pact-broker

这是我的服务提供商的pom片段

<serviceProviders>
                        <serviceProvider>
                            <name>StoreSite</name>
                            <protocol>https</protocol>
                            <host>https://somesiteurl.com</host>
                            <path></path>
                            <consumers>
                                <consumer>
                                    <name>FrontSite</name>
                                    <pactUrl>http://[::1]:8080/pacts/provider/StoreSvc/consumer/SiteSvc/latest</pactUrl>
                                </consumer>
                            </consumers>
                        </serviceProvider>
                    </serviceProviders>

和pact之后:验证操作。我在堆栈跟踪下面得到了构建错误。 我可以看到在localhost代理中生成的pact文件。但是,当端点更改为https时,验证将继续失败。

[DEBUG]   (s) name = StoreSite
[DEBUG]   (s) protocol = https
[DEBUG]   (s) host = https://somesiteurl.com
[DEBUG]   (s) name = FrontSite
[DEBUG]   (s) pactUrl = http://[::1]:8080/pacts/provider/StoreSvc/consumer/SiteSvc/latest
[DEBUG]   (s) consumers = [au.com.dius.pact.provider.maven.Consumer()]
[DEBUG]   (f) serviceProviders = [au.com.dius.pact.provider.maven.Provider(null, null, null, null)]
[DEBUG] -- end configuration --

Verifying a pact between FrontSite and StoreSite
  [from URL http://[::1]:8080/pacts/provider/StoreSite/consumer/FrontSite/latest]
  Valid sign up request
[DEBUG] Verifying via request/response
[DEBUG] Making request for provider au.com.dius.pact.provider.maven.Provider(null, null, null, null):
[DEBUG]     method: POST
path: /api/v1/customers
    headers: [Content-Type:application/json, User-Agent:Mozilla/5.0 
    matchers: [:]
    body: au.com.dius.pact.model.OptionalBody(PRESENT, {"dob":"1969-12-17","pwd":"255577_G04QU","userId":"965839_R9G3O"})
      Request Failed - https

Failures:

0) Verifying a pact between FrontSite and StoreSite - Valid sign up request
      https

1 个答案:

答案 0 :(得分:0)

我试图验证一个名为BusService的服务,该服务在https上运行并让它像这样工作。我的示例与您的示例设置方式不同,但我认为重要的区别是添加了标记ProductException e=new ProductException("Error..Product not found"); throw e; ,并且只使用了主机标记<insecure>true</insecure>中的服务器名称。

<host>localhost</host>