Class ProtoDocumentSource

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

Loads a text document from inline content, a local file, or an HTTP(S) URL.

public static class ProtoDocumentSource
Inheritance
ProtoDocumentSource
Inherited Members

Methods

IsApplicationPath(string, string?)

Whether source is a path the application serves (/openapi/v1.json) with no base address to resolve it against and no file by that name. Such a document loads from the application once the run can reach it, through LoadTextAsync(string, HttpClient, CancellationToken).

public static bool IsApplicationPath(string source, string? baseUrl = null)

Parameters

source string
baseUrl string

Returns

bool

LoadText(string, string?, HttpClient?, params string[])

Loads a text document from inline content, a local file, or an HTTP(S) URL.

public static string LoadText(string source, string? baseUrl = null, HttpClient? httpClient = null, params string[] inlinePrefixes)

Parameters

source string

An inline document, a local file path, or an absolute or relative URL.

baseUrl string

The origin a relative URL resolves against, when one is configured.

httpClient HttpClient

The client to retrieve a URL with; the shared one is used when omitted.

inlinePrefixes string[]

The document-format prefixes the calling integration recognizes - an SDL document starts with type , an OpenAPI document with openapi:. Core knows only that a multi-line body or a JSON object/array is inline, so each format's vocabulary stays with that format.

Returns

string

LoadTextAsync(string, HttpClient, CancellationToken)

Loads a document from an application's client, relative to the client's base address.

public static Task<string> LoadTextAsync(string source, HttpClient client, CancellationToken cancellationToken = default)

Parameters

source string
client HttpClient
cancellationToken CancellationToken

Returns

Task<string>