RESTClient.NET.Core
1.1.0
.NET 9.0
This package targets .NET 9.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package RESTClient.NET.Core --version 1.1.0
NuGet\Install-Package RESTClient.NET.Core -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RESTClient.NET.Core" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RESTClient.NET.Core" Version="1.1.0" />
<PackageReference Include="RESTClient.NET.Core" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RESTClient.NET.Core --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RESTClient.NET.Core, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RESTClient.NET.Core@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RESTClient.NET.Core&version=1.1.0
#tool nuget:?package=RESTClient.NET.Core&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RESTClient.NET
A comprehensive C# library for parsing HTTP files with full VS Code REST Client compatibility and ASP.NET Core integration testing capabilities.
โจ Features
- ๐ 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
๐ฆ Packages
Package | Version | Description |
---|---|---|
RESTClient.NET.Core | Core HTTP file parsing library | |
RESTClient.NET.Testing | ASP.NET Core integration testing framework |
๐ Quick Start
Installation
# Core library
dotnet add package RESTClient.NET.Core
# Testing framework
dotnet add package RESTClient.NET.Testing
Basic Usage
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}");
}
ASP.NET Core Integration Testing
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);
}
}
HTTP File Example
@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}}"
}
๐ Documentation
Getting Started
- ๐ Getting Started Guide - Complete introduction and setup
- ๐งช Integration Testing Guide - ASP.NET Core testing patterns
- ๐ API Reference - Complete API documentation
Reference
- ๐ HTTP File Reference - Complete syntax reference
- ๐ง Troubleshooting Guide - Common issues and solutions
- ๐ผ Sample Projects - Working examples and templates
Additional Resources
- ๐ Implementation Status - Current development status
- ๐ฌ Integration Testing Details - Comprehensive testing specifications
- ๐ Product Requirements (PRD) - Detailed project specifications
๐งช Testing
# 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
๐ Requirements
- .NET 8+ (primary target)
- .NET Standard 2.0 (for broader compatibility)
- VS Code REST Client format compatibility
๐ค Contributing
- 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
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with โค๏ธ for the .NET community
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
- Newtonsoft.Json (>= 13.0.3)
- System.Text.RegularExpressions (>= 4.3.1)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RESTClient.NET.Core:
Package | Downloads |
---|---|
RESTClient.NET.Testing
ASP.NET Core integration testing framework for RESTClient.NET that uses HTTP files as test data sources |
GitHub repositories
This package is not used by any popular GitHub repositories.