HTTP Client Enhancements
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.
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:
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
Subscribe to Blog updates
Thanks, we've got you!
Qodana Clone Finder: Early Access Program
In December 2020, we announced the EAP for Qodana, which is rapidly evolving into a comprehensive platform that allows companies to perform multi-level evaluations of the quality of code they own, contract, or purchase. Qodana helps you detect bugs without relying on an IDE, either on a local machi…
PhpStorm 2020.2 EAP #3
The Early Access Program for PhpStorm 2020.2 is in full swing and today we’ve got the third build of the 2020.2 EAP for you. In this blog post, you can read about improvements for Git installed in WSL2 and Search Everywhere. Download PhpStorm 2020.2 EAP (more…)…
PhpStorm 2019.3.3 Preview
We’ve just rolled out a preview for the third minor update for PhpStorm 2019.3. Please give the PhpStorm 2019.3.3 Preview build 193.6494.5 a try and share your feedback with us. (more…)…
How to Upgrade to PHP 7.4 with PhpStorm
Check out our fresh video with a few nice tips and tricks on how to update your codebase to PHP 7.4. It combines materials from the PhpStorm 2019.2 and PhpStorm 2019.3 releases, with a few cool bonuses to boot. Nikita drew our attention to the fact that setters are slower than assigning prop…