gpt4 book ai didi

线模 : how to upload file to folder __files with API

转载 作者:行者123 更新时间:2023-12-02 09:12:09 24 4
gpt4 key购买 nike

wiremock 的文档说我们可以通过以下代码模拟检索文件的请求:

{
“要求”: {
“方法”:“获取”,
"url": "/body 文件"
},
“回复”: {
“状态”:200,
“bodyFileName”:“路径/到/myfile.xml”
}
}

但现在我必须找到一种方法来真正上传文件,否则我的请求会出现 500 错误。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /body-file. Reason:

<pre> java.lang.RuntimeException: java.io.FileNotFoundException: /wiremock-standalone/./__files/path/to/myfile.xml (No such file or directory)</pre>
</p>
<hr />
<i>
<small>Powered by Jetty://</small>
</i>
</body>

精度:由于我们的基础设施限制,我无法直接上传文件。

最佳答案

最近的 Wiremock 版本具有管理 stub 文件的端点(请参阅 https://github.com/tomakehurst/wiremock/blob/2.19.0/src/main/java/com/github/tomakehurst/wiremock/admin/AdminRoutes.java#L77)

您可以使用 PUT 将文件上传到 /__admin/files/{filename}。存储在${pwd}/__files下。

关于线模 : how to upload file to folder __files with API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46316393/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com