将容器内的Rest呼叫转发到主机上运行的Wiremock

时间:2019-01-31 00:59:25

标签: docker junit docker-compose wiremock

我有一个spring boot应用程序,该应用程序执行在docker容器中运行的Rest调用。我想将这些Rest Call转发到运行Wiremock的主机,并将JSON发送回运行在容器上的应用程序。这可能吗?我已经尝试在docker-compose文件中发布如下所示的端口,但是在那里没有运气。

端口: -“ 127.0.0.1:9233:9233”

以下是我得到的例外。

由以下原因引起:org.apache.http.MalformedChunkCodingException:预期在块末出现CRLF     在org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:253)     在org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:225)     在org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:184)     在org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:213)     在org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:315)     在org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:143)     在org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)     在org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:172)     在java.util.zip.InflaterInputStream.close(InflaterInputStream.java:227)     在java.util.zip.GZIPInputStream.close(GZIPInputStream.java:136)     在org.apache.http.client.entity.LazyDecompressingInputStream.close(LazyDecompressingInputStream.java:94)     在sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:378)     在sun.nio.cs.StreamDecoder.close(StreamDecoder.java:193)     在java.io.InputStreamReader.close(InputStreamReader.java:199)     在java.io.BufferedReader.close(BufferedReader.java:525)     在com.isirona.drivers.welchallyn.sdk.com.types.JSONCom.callJSONService(JSONCom.java:91)     ...省略了7个常见框架

1 个答案:

答案 0 :(得分:0)

尝试配置 U​​RL,如 http://host.docker.internal:8080 输入运行wiremock 服务器的端口号,而不是8080。