这是用户在 2024-10-14 20:54 为 https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
IntelliJ IDEA
 
Get IntelliJ IDEA

HTTP Client HTTP 客户端

Last modified: 30 August 2024
最后修改日期:2024 年 8 月 30 日

With the HTTP Client plugin, you can create, edit, and execute HTTP requests directly in the IntelliJ IDEA code editor.
使用HTTP 客户端插件,您可以在 IntelliJ IDEA代码编辑器中直接创建、编辑和执行 HTTP 请求。

https://resources.jetbrains.com/help/img/idea/2024.2/basic_request.png

There are two main use cases when you need to compose and run HTTP requests:
当你需要组合和运行 HTTP 请求时,有两个主要的使用场景:

  • When you are developing a RESTful web service and want to make sure it works as expected, is accessible in compliance with the specification, and responds correctly.
    当您正在开发一个 RESTful 网络服务,并且希望确保其按照预期工作,符合规范并正确地响应时。

  • When you are developing an application that addresses a RESTful web service. In this case, it is helpful to investigate the access to the service and the required input data before you start the development. During development, you may also call this web service from outside your application. This may help locate errors when your application results in unexpected output while no logical errors are detected in your code, and you suspect that the bottleneck is the interaction with the web service.
    当您开发一个处理 RESTful web 服务的应用程序时,调查服务的访问和所需的输入数据在开始开发之前非常有帮助。在开发过程中,您还可以从应用程序外部调用此 web 服务。当您的应用程序产生意外输出而且代码中没有检测到逻辑错误时,怀疑瓶颈是与 web 服务的交互时,这可能有助于定位错误。

HTTP requests are stored in .http and .rest files and are marked with the HTTP file icon icon.
HTTP 请求存储在 .http.rest 文件中,并且使用 HTTP file icon 图标标记。

Support for HTTP files includes the following features:
支持 HTTP 文件的功能包括以下特点:

If necessary, before you begin, configure the Proxy settings on the HTTP Proxy page of the Settings dialog (Сmd0,) .
如果需要,在开始之前,请在“设置”对话框( Сmd 0, )的HTTP 代理页面上配置代理设置。