RESTClient.NET.Core 1.1.0

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" />
                    
Directory.Packages.props
<PackageReference Include="RESTClient.NET.Core" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=RESTClient.NET.Core&version=1.1.0
                    
Install as a Cake Tool

RESTClient.NET

CI codecov RESTClient.NET.Core RESTClient.NET.Testing

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 NuGet Core HTTP file parsing library
RESTClient.NET.Testing NuGet 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

Reference

Additional Resources

๐Ÿงช 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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests
  4. Ensure all tests pass (dotnet test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. 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 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.

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.

Version Downloads Last Updated
1.1.0 137 8/20/2025
1.0.0 137 8/18/2025
0.2.0 126 8/18/2025
0.1.0 134 8/17/2025