A comprehensive C# library for parsing HTTP files with full VS Code REST Client compatibility and ASP.NET Core integration testing capabilities.
- π VS Code REST Client Compatibility - Full support for standard
# @name
format - π² System Variables - Built-in variables (
{{$guid}}
,{{$randomInt}}
,{{$timestamp}}
,{{$datetime}}
) - β
Enhanced Expectations - Parse
# @expect-*
comments for automated testing - π Name-Based API - Complete request lookup and validation
- π‘οΈ Robust Error Handling - Detailed validation with clear error messages
- π§ͺ ASP.NET Core Integration - Full testing framework with WebApplicationFactory support
Package | Version | Description |
---|---|---|
RESTClient.NET.Core | Core HTTP file parsing library | |
RESTClient.NET.Testing | ASP.NET Core integration testing framework |
# Core library
dotnet add package RESTClient.NET.Core
# Testing framework
dotnet add package RESTClient.NET.Testing
using RESTClient.NET.Core;
var parser = new HttpFileParser();
var httpFile = await parser.ParseAsync("requests.http");
// Get request by name
var loginRequest = httpFile.GetRequestByName("login");
Console.WriteLine($"Method: {loginRequest.Method}");
Console.WriteLine($"URL: {loginRequest.Url}");
// Access expectations
foreach (var expectation in loginRequest.Metadata.Expectations)
{
Console.WriteLine($"Expectation: {expectation.Type} = {expectation.Value}");
}
using RESTClient.NET.Testing;
using RESTClient.NET.Testing.Assertions;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
public class ApiIntegrationTests : HttpFileTestBase<Program>
{
public ApiIntegrationTests(WebApplicationFactory<Program> factory) : base(factory) { }
protected override string GetHttpFilePath() => "HttpFiles/api-requests.http";
[Theory]
[MemberData(nameof(HttpFileTestData))]
public async Task ExecuteRequest_ShouldMeetExpectations(HttpTestCase testCase)
{
// Arrange
var client = Factory.CreateClient();
var requestMessage = testCase.ToHttpRequestMessage();
// Act
var response = await client.SendAsync(requestMessage);
// Assert - Framework automatically validates expectations
await HttpResponseAssertion.AssertResponse(response, testCase.ExpectedResponse);
}
[Fact]
public async Task GetSpecificRequest_ShouldWork()
{
// Arrange
var client = Factory.CreateClient();
var testCase = GetTestCase("login");
// Act
var response = await client.SendAsync(testCase.ToHttpRequestMessage());
// Assert
Assert.Equal(200, (int)response.StatusCode);
}
}
@baseUrl = https://api.example.com
# @name login
# @expect status 200
# @expect header Content-Type application/json
# @expect body-contains "token"
POST {{baseUrl}}/auth/login HTTP/1.1
Content-Type: application/json
X-Request-ID: {{$guid}}
{
"username": "user@example.com",
"password": "secure_password",
"sessionId": "{{$randomInt 1000 9999}}"
}
- π Getting Started Guide - Complete introduction and setup
- π§ͺ Integration Testing Guide - ASP.NET Core testing patterns
- π API Reference - Complete API documentation
- π HTTP File Reference - Complete syntax reference
- π§ Troubleshooting Guide - Common issues and solutions
- πΌ Sample Projects - Working examples and templates
- π Implementation Status - Current development status
- π¬ Integration Testing Details - Comprehensive testing specifications
- π Product Requirements (PRD) - Detailed project specifications
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Build entire solution
dotnet build vscode-restclient-dotnet.slnx --configuration Release
- .NET 8+ (primary target)
- .NET Standard 2.0 (for broader compatibility)
- VS Code REST Client format compatibility
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes and add tests
- Ensure all tests pass (
dotnet test
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ for the .NET community