HTTP Client Enhancements

Posted on by Anton Monakov

We continue improving the editor-based HTTP client, and PhpStorm 2018.2 brings several useful enhancements to it: you can now use environment variables inside the request body, apply code formatting to POST request bodies, and enjoy built-in Unicode support.

Let’s take a closer look at these new features.

Support for environment variables in the request body

Environment variables let you parameterize certain parts of your request and substitute them with actual values when a request is executed. Previously, you could use variables for specifying the request’s host, port, and path, query parameter or value, and header value.

In PhpStorm 2018.2, you can use variables for providing arbitrary values within the POST request body, too.

The idea remains the same: declare your variables in an env file, and use the variables’ placeholders enclosed between double curly braces either directly inside an HTTP file or in the external files that you’ve included as the request body.

When you execute the request, PhpStorm will prompt you to choose the environment holding the desired variable’s value:


Formatting of POST request body

Another improvement you’ll notice when working with POST requests in PhpStorm 2018.2 is the ability to format the request’s body.

To use it, simply invoke the Code | Reformat code action.

POST Body reformat

The request’s body will be formatted in accordance with its Content-Type ; if necessary, you can customize the code style for the corresponding language (for example, JSON or XML) under Preferences | Editor | Code Style.

Please note that formatting HTTP requests that contain variables in the request body is currently not supported. To format such a request, press Alt+Enter and choose Edit JSON/XML fragment. The fragment will open in a separate editor tab, from where you can format is as usual:

POST Body reformat

Decoding Unicode entities and character escapes in JSON replies

PhpStorm 2018.2. introduces the long-awaited support for Unicode symbols and character escape sequences in the HTTP response body.


With this support in place, you can inspect your responses in a natural manner, without looking into the characters table to find out what these magical letters actually translate to.

Your JetBrains PhpStorm Team
The Drive to Develop

Comments below can no longer be edited.

7 Responses to HTTP Client Enhancements

  1. aqeeliz says:

    August 15, 2018

    Is there any way to send url params in a POST request?

    For a POST request with URL like {{host}}/something.json?one=param&two=param
    this only sends {{host}}/something.json

  2. Boris Lednár says:

    October 10, 2018

    Great stuff! Finally I can chain my requests and pass results to another requests 🙂

    It would be great if you could name requests since now it creates configurations by request number (position in file), for example “request #20”, but if I add/delete some requests before this, my saved configuration needs to be updated

    And another thing I would like is to somehow call HTTP requests from response handler (or script it inside HTTP Client), not sure if that’s possible somehow. Use case is like this: I make POST request to some endpoint, it returns array with X numbers and I would like to make another X requests to different endpoint with each number as request param

    And what about possibility to have separate file for each file with HTTP requests to avoid having millions of enviroments defined.

    • Eugene Morozov says:

      October 11, 2018

      All three are valid feature requests, I haven’t found a single duplicate.
      Could you please file them?

      • Boris Lednár says:

        October 12, 2018

        cool, I will do that soon 🙂

        One more question: I was thinking about learning and trying to make some plugin, is there any documentation/article/hint/tips about extending HTTP client (I will read SDK DevGuide, but other than that)? Let’s say I would like to add possibility to set variables at the start of the request collection file, which could be used similar to env variables (maybe there is already some plugin/issue for that, this is just hypothetical :)), is there any docs/source code I can check to see what’s possible?



Subscribe for updates