PQSoft.HttpFile
1.1.0-beta.3
This is a prerelease version of PQSoft.HttpFile.
dotnet add package PQSoft.HttpFile --version 1.1.0-beta.3
NuGet\Install-Package PQSoft.HttpFile -Version 1.1.0-beta.3
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="PQSoft.HttpFile" Version="1.1.0-beta.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PQSoft.HttpFile" Version="1.1.0-beta.3" />
<PackageReference Include="PQSoft.HttpFile" />
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 PQSoft.HttpFile --version 1.1.0-beta.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PQSoft.HttpFile, 1.1.0-beta.3"
#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 PQSoft.HttpFile@1.1.0-beta.3
#: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=PQSoft.HttpFile&version=1.1.0-beta.3&prerelease
#tool nuget:?package=PQSoft.HttpFile&version=1.1.0-beta.3&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PQSoft.HttpFile
A library for parsing HTTP request and response files, similar to Microsoft's VS Code .http files.
Features
- Parse HTTP requests with method, URL, headers, and body
- Parse HTTP responses with status code, headers, and body
- Handle HTTP headers with parameters
- Semantically compare parsed headers for testing purposes
This package is particularly useful for API testing scenarios where you need to parse and validate HTTP traffic.
Installation
dotnet add package PQSoft.HttpFile
Usage
Basic Request Parsing
string httpRequest = @"POST /api/users HTTP/1.1
Host: example.com
Content-Type: application/json
Authorization: Bearer token123
{""name"": ""John"", ""email"": ""john@example.com""}";
var request = HttpRequestParser.Parse(httpRequest);
Console.WriteLine($"Method: {request.Method}"); // POST
Console.WriteLine($"URL: {request.Url}"); // /api/users
Console.WriteLine($"Host: {request.Headers["Host"]}"); // example.com
Console.WriteLine($"Body: {request.Body}"); // JSON content
Basic Response Parsing
string httpResponse = @"HTTP/1.1 201 Created
Content-Type: application/json
Location: /api/users/123
{""id"": 123, ""name"": ""John"", ""email"": ""john@example.com""}";
var response = HttpResponseParser.Parse(httpResponse);
Console.WriteLine($"Status: {response.StatusCode}"); // 201
Console.WriteLine($"Reason: {response.ReasonPhrase}"); // Created
Console.WriteLine($"Location: {response.Headers["Location"]}"); // /api/users/123
Header Comparison for Testing
// Compare headers semantically (useful for testing)
var expected = new Dictionary<string, string> { {"Content-Type", "application/json"} };
var actual = response.Headers;
bool headersMatch = HttpHeaderComparer.Compare(expected, actual);
Working with Complex Headers
string requestWithComplexHeaders = @"GET /api/data HTTP/1.1
Host: api.example.com
Accept: application/json, text/plain; q=0.9
Cache-Control: no-cache, max-age=0
Cookie: session=abc123; theme=dark";
var request = HttpRequestParser.Parse(requestWithComplexHeaders);
// Access header parameters
var acceptHeader = request.Headers["Accept"];
var cookies = request.Headers["Cookie"];
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.1.0-beta.3 | 147 | 9/20/2025 |
1.1.0-beta.2 | 162 | 9/19/2025 |
1.1.0-beta.1 | 167 | 9/19/2025 |
1.0.0-beta.6 | 228 | 9/19/2025 |
1.0.0-beta.5 | 223 | 9/19/2025 |
1.0.0-beta.4 | 225 | 9/19/2025 |
1.0.0-beta.3 | 222 | 9/19/2025 |
1.0.0-beta.2 | 225 | 9/19/2025 |
1.0.0-beta.1 | 241 | 9/19/2025 |
1.0.0-alpha9 | 243 | 9/18/2025 |
1.0.0-alpha8 | 243 | 9/18/2025 |
1.0.0-alpha7 | 249 | 9/17/2025 |
1.0.0-alpha5 | 253 | 9/16/2025 |
1.0.0-alpha4 | 250 | 9/16/2025 |
1.0.0-alpha3 | 250 | 9/16/2025 |
1.0.0-alpha2 | 252 | 9/16/2025 |
1.0.0-alpha11 | 240 | 9/19/2025 |
1.0.0-alpha10 | 241 | 9/18/2025 |
1.0.0-alpha1 | 198 | 9/15/2025 |