Skip to main content

Definition

Assembly: CloudNimble.Breakdance.DotHttp.dll Namespace: CloudNimble.Breakdance.DotHttp Inheritance: System.Object

Syntax

CloudNimble.Breakdance.DotHttp.DotHttpFileParser

Summary

Parses .http files into structured DotHttpFile objects.

Remarks

Implements the full .http file specification as documented at https://learn.microsoft.com/en-us/aspnet/core/test/http-files including variables, request chaining, file references, and multi-line headers.

Examples

var parser = new DotHttpFileParser();
var file = parser.Parse(httpFileContent, "api.http");

// Check for parse diagnostics
foreach (var diagnostic in file.Diagnostics)
{
    Console.WriteLine($"{diagnostic.Location}: {diagnostic.GetMessage()}");
}

// Process requests
foreach (var request in file.Requests)
{
    Console.WriteLine($"{request.Method} {request.Url}");
}

Constructors

.ctor

Syntax

public DotHttpFileParser()

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

Parse

Parses a .http file content into a structured model.

Syntax

public CloudNimble.Breakdance.DotHttp.Models.DotHttpFile Parse(string content, string filePath)

Parameters

NameTypeDescription
contentstringThe content of the .http file.
filePathstringThe file path for reference in the model.

Returns

Type: CloudNimble.Breakdance.DotHttp.Models.DotHttpFile A DotHttpFile containing the parsed requests, variables, and any parse errors.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when filePath is null.

Examples

var parser = new DotHttpFileParser();
var content = File.ReadAllText("api.http");
var file = parser.Parse(content, "api.http");

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?