Getting Started with IntelliJ's Text-Based HTTP Client

This guide explains how to create .http/.rest files in IntelliJ, write and run GET requests, use variables and environment files, separate multiple requests, and share request definitions securely with a team, providing practical examples and code snippets.

FunTester
FunTester
FunTester
Getting Started with IntelliJ's Text-Based HTTP Client

IntelliJ provides a pure text‑based HTTP client that lets you define and execute HTTP requests directly from .http or .rest files.

To begin, create a file whose name ends with .http or .rest, for example FunTester.http, and write a simple GET request such as: GET https://api.muxiaoguo.cn/api/dujitang IntelliJ adds a small Run‑icon beside the line, allowing you to send the request with a click. The response is displayed, for example:

GET https://api.muxiaoguo.cn/api/dujitang<br/><br/>HTTP/1.1 200 OK<br/>Server: nginx<br/>Date: Tue, 22 Sep 2020 08:17:55 GMT<br/>Content-Type: text/html; charset=utf-8<br/>…<br/>{"code":"200","msg":"success","data":{"comment":"你以为有钱人很快乐吗?他们的快乐你根本想象不到!"}}

If you need to send JSON parameters, add a Content-Type header and include the request body, e.g.:

GET  https://api.muxiaoguo.cn/api/dujitang<br/>Content-Type: application/json<br/><br/>{"aa":"FunTester","ss":"ok"}

Multiple requests in the same file are separated with ###:

GET  https://api.muxiaoguo.cn/api/dujitang<br/>…<br/><br/>###<br/><br/>GET  https://api.muxiaoguo.cn/api/dujitang<br/>…

Variables can be inserted using the {{..}} syntax. Define them in an http-client.env.json file, for example:

{
  "development": {"host": "http://localhost:8080"},
  "production": {"host": "http://my-cool-api.com"}
}

You can then write requests like GET http://{{host}}/products and select the desired environment when running the request.

Because request definitions are plain text, they can be easily shared with a team and checked into version control. Sensitive data such as API keys should be placed in a private file ( http-client.private.env.json) and excluded from the repository.

IntelliJ also supports private environment files for storing secrets, ensuring they are not inadvertently committed.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend DevelopmentAPI testingIntelliJHTTP clientEnvironment Variablesrequest files
FunTester
Written by

FunTester

10k followers, 1k articles | completely useless

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.