Keep API Experiments Beside the Code with WebStorm's HTTP Client
Store API requests as .http files in WebStorm to keep them versioned, reviewable, and reproducible without switching to an external tool.
04 Dec 2025, 19:39 UTC

The request that disappears
You find a bug in an API integration. You reproduce it with a quick request in an external API tool, paste the URL and body into a chat message, and move on. Two weeks later, a teammate hits the same issue, but the original request is stale, the environment variables are gone, and the context that made it meaningful has evaporated. Ad-hoc requests that live outside the repository tend to rot.
WebStorm's built-in HTTP Client offers a simpler alternative for many day-to-day tasks: store requests as plain-text .http files directly in your project. They become versioned artifacts that teammates can review in pull requests and run with a single click.
How .http files work
A .http file is plain text. Each request is separated by a ### delimiter. WebStorm recognizes standard methods like GET and POST, and it substitutes variables such as {{baseUrl}} from an environment file or from definitions inside the file itself. When you click the green run icon in the gutter, the IDE sends the request and displays the response—status code, headers, and body—in the Services tool window.
Environment files let you swap targets without editing the request. A variable like {{baseUrl}} can point to http://localhost:8080 during local development and to a staging URL when you switch the active environment in the IDE. You can also use pre-request scripts and post-response handlers for lightweight token management.
A practical setup
Consider a project with a local backend. Instead of switching to an external tool, create a file named api.http in the project root.
### Get all users
GET {{baseUrl}}/users
Accept: application/json
### Create a user
POST {{baseUrl}}/users
Content-Type: application/json
{
"name": "Ada Lovelace",
"email": "[contact removed]"
}
Next to it, create an environment file in the project root with a local definition:
{
"local": {
"baseUrl": "http://localhost:8080"
}
}
Select the local environment from the run configuration dropdown, then click the gutter icon beside the GET request. WebStorm sends the call and streams the response into the Services tool window. The same file can contain a POST with a JSON body, letting you verify both reads and writes without leaving the editor.
Where to run: Inside the WebStorm editor on any machine with the project checked out. No special permissions are required beyond normal file access.
Expected checks: A green triangular icon appears in the gutter next to each request. After running, the Services tool window opens with the status code and response body.
Risks: Do not commit real credentials in .http or environment files. Use gitignored files or local secret sources referenced by variables.
Limitations and trade-offs
The HTTP Client is not a replacement for a full API platform. It lacks shared workspaces, mock servers, and scheduled monitoring. Scripting is intentionally minimal compared with dedicated suites, so complex OAuth flows or chained authentication may still require an external tool. Very large response bodies can also make the Services window sluggish; for heavy endpoints, limit the output size or avoid previewing the full payload.
An actionable closing
Commit a small api.http for the critical endpoints your team touches most. Add scratch.http to .gitignore for throwaway experiments. Pair the requests with environment files so secrets stay out of version control while teammates can still reproduce important calls. The next time a bug depends on a specific request, the exact call will be sitting in the repo, ready to run.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.