Author Profile Image

Maximilian Leodolter

3 min read

The easiest way I know to test your API

I get it: tools like Insomnia and Postman are fantastic. They provide a collaborative and user-friendly solution for a complex problem: testing your REST API.

But what if there was an alternative—something easier to learn, yet powerful, and directly integrated into your code editor?

If that idea excites you, check out this VS Code plugin. It’s amazing: it integrates seamlessly with your project, supports version control, and even allows you to use variables.

Getting Started

After installing the plugin, you're almost ready to go. Simply open an existing project or create a new one, then add a file ending in .http (e.g., localhost.http).

Open that file in VS Code and try your first request:

GET http://localhost:3000/api/example

As you type, a small prompt should appear above your request saying "Send Request." Click it, and a results pane should appear on the left.

If something goes wrong, a toast notification will appear in the bottom right. Double-check the request you wrote:

  1. Is the URL correct?
  2. Did you follow the syntax?

Making a POST Request

POST http://localhost:3000/api/example
Content-Type: application/json

{
    "salutation": "mr",
    "name": "Maximilian",
    "role": "Software Tester",
    "department": "QA"
}

Notice that headers are written directly below the request text.

Writing Multiple Requests in One File

Simply separate them with ###:

GET http://localhost:3000/api/example

### You can add a comment here
POST http://localhost:3000/api/example
Content-Type: application/json

{
    "salutation": "mr",
    "name": "Maximilian",
    "role": "Software Tester",
    "department": "QA"
}

Using Variables

The plugin has a straightforward templating language: use @ to define a variable and {{ }} to reference it. Here’s an example using a variable for the hostname:

@host = http://localhost:3000

GET {{host}}/api/example

### You can add a comment here
POST {{host}}/api/example
Content-Type: application/json

{
    "salutation": "mr",
    "name": "Maximilian",
    "role": "Software Tester",
    "department": "QA"
}

You can use variables throughout the entire file, including in headers and bodies.

With this setup, you've embedded endpoint tests directly within your project. And if you use Git, your entire team can access them!