DEV Community

Andy
Andy

Posted on

Step-by-Step Guide: Testing HTTP Endpoints in Visual Studio 2022 Using Endpoints Explorer

Visual Studio 2022 (v17.6) has introduced a new feature that simplifies the process of discovering and testing API endpoints. With this new feature, we can now effortlessly locate and test API endpoints within Visual Studio itself, streamlining our testing workflow.

The Visual Studio team has dedicated significant resources to enhance the experience of API development, testing, and debugging. Among the numerous recent additions, the Endpoints Explorer stands out as a noteworthy feature.


Endpoints Explorer

To use this feature go to View –> Other Windows –> Endpoint Explorer

Image description

It automatically identifies the endpoints within our project that utilize the [ApiController] attribute, providing us with a comprehensive overview of the project and its associated endpoints.

Image description

If we invoke Generate Request an HTTP file will be generated with the request for the /api/users

Image description

The following process has occurred:

  1. An HTTP file was created and added to the project.
  2. A variable was created to store the host address.
  3. The request was added to the file.

Let's run our API and make some HTTP requests.

HTTP Get

After sending the request, we can instantly view the response on the right side, providing immediate visibility into the received data.

Image description

HTTP Post

Image description

Debugging

Highly intuitive for debugging!!! :)

Image description


Final Thoughts

The feature greatly simplifies the process of testing HTTP endpoints and verifying the response, eliminating the need for external tools such as Postman or Insomnia.


Thanks for reading!

Through my articles, I share Tips & Experiences on web development, career, and the latest tech trends. Join me as we explore these exciting topics together. Let’s learn, grow, and create together!

βž•More article about Programming, Careers, and Tech Trends.

πŸ”” Follow me on Medium | Twitter

Top comments (1)

Collapse
 
achargoy profile image
Chargoy

is that option available for a specific visual studio version? I don't see it, working on Visual Studio Community 2022 17.7.4