用于测试的 HTTP Post 多部分工具

发布于 2024-12-04 17:59:45 字数 78 浏览 0 评论 0原文

有谁知道一个小测试工具(例如 Firefox 的 Poster / RestTool)能够上传文件并在同一个帖子请求(多部分)中发送文本正文?

does anyone know a little test tool (like Poster / RestTool for Firefox) that is able to upload a file and send a text body within the same post request (Multipart)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

伤痕我心 2024-12-11 17:59:46

它不是 firefox-addon,但我真正推荐的是使用 curl 工具。它非常适合使用 RESTful HTTP API,因为它非常接近 HTTP 协议。因为它是基于 CLI 的,所以作为图形插件更灵活(例如,您可以邮寄或可以使用示例调用来记录您的 api)。

例如,使用curl 执行多部分请求将是:


# with '-v' verbose-switch you see some headers
# with '-F' you are "activating" single multiparts
# with '@' you are referencing file
curl -v -F [email protected] -F [email protected] http://host.com/your/multipart/endpoint

# if server needs it you can also pass Content-Type with single files
... -F "[email protected];type=text/plain" ...

您期望在服务器端获得哪种多部分(例如多部分/表单数据或多部分/混合)。

有什么理由让它必须是一个火狐插件吗?我见过有人使用 RestClient,但我从未见过它与多部分一起工作。

It is not a firefox-addon, but what I can really recommend is to use curl tool. It fits perfect when playing around with RESTful HTTP APIs because it is very close to HTTP protocol. Because it is CLI based it is more flexible as graphical addon (e.g. you can mail around or can document your api with sample calls).

E.g. doing a multipart request with curl would be:


# with '-v' verbose-switch you see some headers
# with '-F' you are "activating" single multiparts
# with '@' you are referencing file
curl -v -F [email protected] -F [email protected] http://host.com/your/multipart/endpoint

# if server needs it you can also pass Content-Type with single files
... -F "[email protected];type=text/plain" ...

What kind of multipart do you expect on server-side (e.g. multipart/form-data or multipart/mixed).

Is there a reason why it has to be a firefox addon? I have seen people using RestClient, but I never saw it working with multipart.

寻找我们的幸福 2024-12-11 17:59:46

您可以使用 Firefox poster 插件发送多部分 HTTP 帖子。

  1. 选择“参数”选项卡
  2. 输入多部分“名称”和“值”
  3. 按“添加/更改” 选择
  4. “要发送的内容”选项卡
  5. 按“参数正文”
  6. 根据需要输入您的 URL 和用户身份验证
  7. 按“POST”

You can use Firefox poster add-on to send HTTP posts with multipart.

  1. Select "Parameters" tab
  2. Enter the multipart "Name" and "Value"
  3. Press "Add/Change"
  4. Select "Content to Send" tab
  5. Press "Body from Parameters"
  6. Enter your URL and User Auth, as required
  7. Press"POST"
懷念過去 2024-12-11 17:59:46

对于 Chrome/Chromium,有出色的 Postman 应用程序/扩展: http://www.getpostman.com/

有关简短的视觉教程,您可以查看:https://stackoverflow.com/a/16022213/1667104

For Chrome/Chromium there is the excellent Postman app/extension: http://www.getpostman.com/ .

For a brief visual tutorial you can check: https://stackoverflow.com/a/16022213/1667104 .

黎歌 2024-12-11 17:59:46

我现在喜欢在我的大多数 HTTP 项目中包含 http://aminus.net/wiki/Okapi

I like to include http://aminus.net/wiki/Okapi in most of my HTTP projects these days.

ヤ经典坏疍 2024-12-11 17:59:46

Firefox 有一些:

和 @joff 之前提到的海报

Firefox has a few:

and poster as mentioned earlier by @joff

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文