I usually use Visual Studio Code for full-stack development, and sometimes I need to use PostMan for API testing. I recently found a useful extension to Visual Studio Code: the REST Client, which partially replaces PostMan. Especially to share with you:

Once installed, create a file with any name in the Visual Studio Code project, as long as it meets the.http suffix. To achieve PostMan’s purpose of calling a RESTful API via an HTTP POST, paste the following:

POST https://example.com/comments HTTP / 1.1 the content-type: application/json {" name ":" sample ", "time" : "Wed, 21 Oct 2015 18:27:50 GMT" }

Click on the Send Request hyperlink in the image above to see the API response in the Visual Studio Code editing area to the right.

You can do the same thing by right-clicking the.http file editing area and selecting Send Request from the right-click menu.

You can also find the option of Generate Code Snippt in the right-click menu above, that is, automatically Generate the calling Code of the HTTP request.

You can choose which programming language to generate the calling code in. For example, if I select Node.js:

Then, it is thoughtful to give which Node.js HTTP tool library generates the call code:

The following figure shows the call code generated based on the Node.js Request tool library. Can save developers some manual coding time.

In the Visual Studio Code status bar, on the mouse hover, you can see the specific composition of this time.

For the basic functionality of PostMan, this extension is sufficient. It remains to be seen whether some of PostMan’s advanced features, such as automatically invoking a series of logical PostMan requests, can also be implemented with this extension.

More of Jerry’s original articles can be found on “Wang Zixi “: