英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论