网页 综合 更新时间 2026-11-14 02:29:08

HTTP Client | AppCode Documentation

自动蜘蛛 www.jetbrains.com 正文约 5216 字
HTTP Client | AppCode Documentation
With the HTTP Client plugin, you can create, edit, and execute HTTP requests directly in the AppCode code editor.
There are two main use cases when you need to compose and run HTTP requests:
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.
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 the 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.
HTTP requests are stored in .http and .rest files and are marked with the icon.
Support for HTTP files includes the following features:
Code completion for hosts, method types, header fields, and endpoints defined via OpenAPI
Code folding for requests, their parts, and response handler scripts
Reformat requests according to your HTTP Request code style.
Inline documentation for request header fields and doc tags
Viewing a structure of HTTP requests
Language injections in Web languages inside the request message body
If necessary, before you begin, configure the Proxy settings on the HTTP Proxy page of the Preferences dialog (Ctrl+Alt+S).
You can work with HTTP requests either from scratch files or from physical files of the HTTP Request type. Each file can contain multiple requests, and you can create as many files as needed.
Scratch files can be used to test HTTP requests during development. Scratch files are not stored inside a project, so AppCode can modify them and add additional information about the request. When an HTTP request is executed from a scratch file, the link to the response output file is added below the request and at the top of the requests history file.
Press Ctrl+Alt+Shift+Insert and select HTTP Request.
Physical files can be used for documenting, testing, and validating HTTP requests. Physical files are stored inside your project, and AppCode will not modify them. When an HTTP request is executed from a physical file, this file is not modified. Information about the executed request with the link to the response output file is added to the top of the requests history file.
In the File menu, point to New, and then click HTTP Request.
You can use the Move refactoring F6 to move HTTP requests from scratches to physical files, as well as between physical files.
In the editor, position the caret at the request to be moved and do one of the following:
From the main menu or the context menu, select Refactor | Move.
Press Alt+Enter and select the Move HTTP Requests intention action.
In the Move HTTP Requests dialog that opens, do the following:
In the Path field, choose one of the existing .http files from the list or click to locate the file.
You can also type the full path to the file manually. If you specify the name of a non-existing file, a new file with the provided name will be created automatically.
In the Requests list, select the checkboxes next to the requests you want to move.
AppCode uses the HTTP request in Editor format, which provides a simple way to create, execute, and store information about HTTP requests. You can type them directly in the created HTTP request files using the following general syntax:
After the ### separator, you can enter any comments preceded by # or //.
To quickly find your request in run/debug configurations, Search Everywhere, and Run Anything, you can give it a name.
You can use the Editor | Color Scheme | HTTP Request settings to customize colors and style for highlighting request syntax (name, comments, parameters, headers, and so on).
To speed up composing HTTP requests, you can:
Click Tools | HTTP Client | Create Request in HTTP Client. If a request file is opened in the editor, this will add a request template to the opened file. Otherwise, this will create a new .http scratch file.
Click on top of the request's editor panel. In the popup menu, choose the type of the request to add.
Alternatively, use live templates. In the editor, you can press Ctrl+J to view the list of available templates. For example, gtr expands to a simple GET request; mptr expands to a multipart/form-data POST request.
To get an overview of the HTTP Client possibilities, you can explore the HTTP Requests Collection, which is a handful selection of composed requests.
Click the Examples shortcut link on top of the request's editor panel.
In the popup menu, choose the HTTP Requests collection you wish to open:
See Exploring the HTTP request syntax for the syntax and capabilities overview, and HTTP request in Editor specification for the full format description.
If you are working with cURL requests, you can convert between cURL requests and the HTTP request in Editor format.
Paste the cURL request into an HTTP request file. AppCode will convert it to the HTTP request format and leave the original cURL request commented out for later reference.
访问原文 返回搜索 https://www.jetbrains.com/help/objc/http-client-in-product-code-editor.html
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。