更改 WireMock 的 __files 目录

huangapple go评论82阅读模式
英文:

Changing WireMock __files directory

问题

文档

> 要从文件中读取正文内容,请将文件放置在 __files 目录下。默认情况下,当从JUnit规则运行时,该目录应位于src/test/resources下;当独立运行时,它将位于启动服务器的当前目录下。要使您的存根使用该文件,只需在响应构建器上调用bodyFile(),并提供相对于 __files 的文件路径:

是否可以更改它?为什么WireMock要坚持使用这个特定的目录?

英文:

From the docs:

> To read the body content from a file, place the file under the __files
> directory. By default this is expected to be under src/test/resources
> when running from the JUnit rule. When running standalone it will be
> under the current directory in which the server was started. To make
> your stub use the file, simply call bodyFile() on the response builder
> with the file’s path relative to __files:

Is it possible to change it? Why would WireMock insist on this specific directory?

答案1

得分: 6

WireMock坚持使用该特定目录,因为它必须具有某些特定目录。

如果你想要更改它,可以这样做。请查看配置文档中的“文件位置”部分。

英文:

WireMock insists on that specific directory because it has to have some specific directory.

If you want to change it, you can do so. Check out the File Locations section under the configuration documentation.

huangapple
  • 本文由 发表于 2020年5月4日 21:32:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/61593477.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定