A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.jetbrains.com/help/idea/exploring-http-syntax.html below:

Exploring the HTTP request syntax

Exploring the HTTP request syntax

This section describes the HTTP request format. For more information about sending HTTP requests and viewing HTTP responses, refer to HTTP Client.

To compose an HTTP request in the IntelliJ IDEA code editor, use the following general syntax:

Method Request-URI HTTP-Version Header-field: Header-value Request-Body

Set names for HTTP requests

To quickly find your request in run/debug configurations, Search Everywhere, and Run Anything, you can give it a name.

If a request does not have a name, IntelliJ IDEA will use its position in the request file (such as #1) as the request name. If a request file contains multiple requests with the same name, IntelliJ IDEA will append the request position number to each of the names. This will make each request name unique so that you can easily find the needed one in the Services tool window, run/debug configurations, and so on.

Use short form for GET requests Compose several requests in a single file
  1. Mark the end of a request by typing the ### separator below it.

    // A basic request https://example.com/a/ ###

  2. Compose another request below the separator.

    // A basic request https://example.com/a/ ### // A second request using the GET method https://example.com:8080/api/html/get?id=123&value=content

Break long requests into several lines Access a web service with authentication

Similarly to other HTTP request elements, the provided username and password can be parameterized by means of environment variables.

Provide the request message body

Inside the request, prepend the request body with a blank line and do one of the following:

Use multipart/form-data content type Disable following redirects

When an HTTP request is redirected (a 3xx status code is received), the redirected page response is returned. In the Services tool window, you can view the redirected page response as well as all redirections that happened during the request.

You may want to disable following redirects. In this case, the actual redirect response header (such as 301 or 302) is returned.

If you already have a redirected request, you can click Disable next to the Redirections list in the Services tool window. This will add the @no-redirect tag to the initial request.

Disable saving requests to requests history

If necessary, you can prevent saving a request to the requests history. This can be helpful in case a request contains some sensitive data, and you don't want to log it.

Disable saving received cookies to the cookies jar

If necessary, you can prevent saving the received cookie to the cookies jar. This way you will avoid removing the unwanted cookies from the http-client.cookies file manually.

Disabling encoding

By default, the HTTP client encodes the request parameters and body into an ASCII format. For example, a slash character in your request parameter will be sent as %2F. You can disable encoding to send the request as it is.

Customize HTTP request timeouts

The HTTP Client has a timeout of 60 seconds for establishing a connection with a server, and a separate 60 seconds timeout for awaiting new packets in ongoing connections. You can customize both of these timeouts.

By default, the timeout values are in seconds, but you can add an explicit unit of time after the value: ms for milliseconds, s for seconds, m for minutes, for example 100 ms or 5 m.

You can also change these timeouts at the IDE level, using VM options ().

Be aware that VM options impact IntelliJ IDEA behavior across the entire application. These timeouts apply not just to HTTP requests made using the HTTP Client, but also to all HTTP requests that IntelliJ IDEA might send when interacting with the network, such as when accessing an external service.

Handle the response

You can handle the response using JavaScript. Type the > character after the request and specify the path and name of the JavaScript file or put the response handler script code wrapped in {% ... %}.

GET https://httpbin.org/get > /path/to/responseHandler.js

GET https://httpbin.org/get > {% client.global.set("my_cookie", response.headers.valuesOf("Set-Cookie")[0]); %}

For more information, refer to HTTP Response handling API reference.

Redirect the response

You can redirect a response to a file. Use >> to create a new file with a suffix if it already exists and >>! to rewrite the file if it exists. You can specify an absolute path or relative to the current HTTP Request file. You can also use variables in paths, including environment variables and the following predefined variables:

The following example HTTP request creates myFile.json in myFolder next to the HTTP Request file and redirects the response to it. If the file already exists, it creates myFile-1.json.

POST https://httpbin.org/post Content-Type: application/json { "id": 999, "value": "content" } >> myFolder/myFile.json

The following example HTTP request creates myFile.json in .idea/httpRequests/. If the file already exists, it overwrites the file. It also handles the response with the handler.js script that resides in the project root.

POST https://httpbin.org/post Content-Type: application/json { "id": 999, "value": "content" } > {{$projectRoot}}/handler.js >>! {{$historyFolder}}/myFile.json

For Windows, specify paths with the backslash \.

14 July 2025


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4