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
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.
If we invoke Generate Request an HTTP file will be generated with the request for the /api/users
The following process has occurred:
- An HTTP file was created and added to the project.
- A variable was created to store the host address.
- 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.
HTTP Post
Debugging
Highly intuitive for debugging!!! :)
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.
Top comments (1)
is that option available for a specific visual studio version? I don't see it, working on Visual Studio Community 2022 17.7.4