How to never leave VSCode for testing your HTTP/JSON APIs

Debo Ray

Cover Image for DevZero

Over the last few years, I’ve gone through various tools for testing HTTP/JSON APIs that I’ve developed. I (obviously) started with cURL, having copied various snippets from StackOverflow. Then, I migrated to Postman, which let me repurpose components of requests while not having to navigate the terminal to modify headers and such (with cURL) - Postman also needed me to do a lot of Googling to figure out the right syntax.

More recently, I’ve been exploring ways of not having to leave my IDE, to further optimize for the decrease in productivity due to context switching. VSCode is my IDE of choice and these are the following tools that I’ve been using recently:

  1. cURL
  2. Integration tests using language-specific HTTP clients
  3. Thunder Client (in VSCode marketplace)
  4. REST Client (in VSCode marketplace)

Here’s my experience using each of these, followed by a score of convenience and shareability. I will use an API I have been working on at DevZero, for each of the tools.

How to use cURL to test endpoints in VSCode

This is a basic request where I have to keep updating the paths and/or the headers till things work. It’s really good for when you want to test the first time that an API works, but starts to get quite cumbersome after - you have to keep scrubbing words (headers, body contents, etc) in the request which takes a lot of time. Unnecessary.

API request shown in VSCode

How to use integration tests to test endpoints in VSCode

This option is great for iterating, but it's kinda time-consuming to get started. Since things are within an IDE and usually operating as a unit test, it’s easy to iterate on as part of the basic IDE debug workflow (I use dlv for Go).

How to use Thunder Client to test endpoints in VSCode

Thunder makes it super easy to iterate on header or body contents. It’s great for the individual developer use-case, especially with the concept of collections and how it “remembers” past requests. Thunder definitely requires the least number of keystrokes/clicks to get to results.

Thunder client in VSCode

How to use REST Client to test endpoints in VSCode

The REST Client makes it very easy to check in test requests, provided everyone on the team has the REST Client installed to make the test calls. It requires some Googling to get the syntax right when setting up the first request, but the ease of shareability by checking in the *.http file makes it the best solution for teams.

REST Client in VSCode

Conclusion

  • Thunder Client is the best for individual testing, optimized for quick feedback loops.
  • REST Client is the best choice for teams due to the ease of shareability.

All free DevZero templates that have HTTP projects within, will have Thunder Client installed by default. They will also have test *.http files readable by REST Client present.

Tags: Developer Productivity, API Testing, VSCode, HTTP/JSON testing, cURL in VSCode, Remote Development, Optimization

Debo Ray

Debo Ray

Co-Founder, CEO

Share this post


Built for the cloud you use.

Use your established cloud provider, or let us supply one for you.

Get started →
Featured Posts
Achieving SOC 2 Compliance: What It Means for DevZero and Our CustomersWhat is Docker, What is it Used For, and How Does it Work?DevZero Wins 2023 DEVIES Microservices & Serverless AwardIntroducing DevZero. It’s time to upgrade localhost.Kubernetes vs. Terraform: Which DevOps/Platform Engineering Tool Do You Need?Lessons from Slack’s GitHub Theft, CircleCI Breach WarningGift Guide for Developers: 10 Gifts to Boost ProductivityWhy Software Development Environments are Important and How to Manage them EffectivelyThe container orchestration tools you need to manage your appsProtect Your Source Code With Cloud Development Environments