.http and .rest files, in the same format as the IntelliJ IDEA HTTP client. Responses show in the Services tool window under the HTTP Client tab.
Create a request file
- Tools › New HTTP Request creates a scratch file
requests.http(thenrequests_2.http, and so on) in the IDE’s scratch folder. - In the Project tool window, New › HTTP Request creates a
.httpfile in the selected folder. - Any file ending in
.httpor.restworks.
Syntax
Variables
Write{{name}} anywhere in the URL, headers or body. A name is looked up in this order:
- File variables:
@name = valuelines. They apply to the whole file; a later definition wins. - The selected environment in
http-client.private.env.json. - The selected environment in
http-client.env.json. $sharedin the private file, then$sharedin the public file.
< are not substituted.
Dynamic variables:
Environments
Put environments inhttp-client.env.json, and secrets in http-client.private.env.json (keep that one out of version control):
http-client.env.json
Run requests
You can also click the run icon in the gutter next to a request line. The editor toolbar has Run All Requests in File, Stop and Run with:.
- The request at the caret is the block containing the caret, or the nearest one above it.
- Unsaved edits are included.
- Starting a new run cancels the one in progress.
- Run All runs requests in order. It stops if a request can’t be prepared (for example, an unresolved variable); network errors are recorded and the next request runs.
Responses
The HTTP Client tab in the Services tool window lists past exchanges on the left, newest first, with status, method, name and time. For the selected one it shows:- The status, HTTP version, total time (hover for the time to headers) and size.
- Response: the body. JSON, XML and HTML are pretty-printed; switch with Show Raw / Show Formatted. Binary bodies show their type and size only. Bodies over 16 MiB are cut off.
- Headers: the response headers.
- Request: the request as it was sent, after variable substitution.
Connection behaviour
- HTTP/1.1 and HTTP/2. gzip, deflate and brotli responses are decoded.
- TLS certificates are verified against the system trust store.
- Redirects are followed.
- Cookies are not kept between requests.
- Connections time out after 30 seconds; there is no overall request timeout.
- The proxy comes from Settings › Appearance & Behavior › System Settings › HTTP Proxy.
Endpoints and Spring
OpenIDEA indexes Spring Web endpoints (@RestController / @Controller classes with @RequestMapping, @GetMapping and similar) in Java and Kotlin:
- A gutter icon on each mapping and controller. Generate Request in HTTP Client and Generate Requests for Controller (also in the editor context menu and as intentions) add requests to a scratch file
generated-requests.httpand open it. - Generated requests use
http://localhost:<server.port>plus the context path fromapplication.propertiesorapplication.yml(port 8080 by default). Path variables become{{var}}, and a JSON skeleton of the@RequestBodytype is filled in. - Search Everywhere has an Endpoints tab.
- In a
.httpfile, URL completion after the method suggests known endpoints.
Not supported
- JavaScript response handlers (
> {% ... %},> handler.js) and pre-request scripts. Handler lines are recognized and skipped. - Saving responses with
>>/>>!, and<>references to previous responses (skipped). - WebSocket, gRPC and GraphQL requests in
.httpfiles. GraphQL has its own support in.graphqlfiles. - Per-request SSL options, client certificates, turning off redirects, and cookie jars.
- Importing from or exporting to cURL.