diff --git a/API/Protocol/IResponseBuilder.cs b/API/Protocol/IResponseBuilder.cs
index bc529f14..d34efcfd 100644
--- a/API/Protocol/IResponseBuilder.cs
+++ b/API/Protocol/IResponseBuilder.cs
@@ -1,6 +1,4 @@
-using System;
-
-using GenHTTP.Api.Infrastructure;
+using GenHTTP.Api.Infrastructure;
namespace GenHTTP.Api.Protocol
{
@@ -8,7 +6,7 @@ namespace GenHTTP.Api.Protocol
///
/// Allows to configure a HTTP response to be send.
///
- public interface IResponseBuilder : IBuilder
+ public interface IResponseBuilder : IBuilder, IResponseModification
{
///
@@ -16,70 +14,18 @@ public interface IResponseBuilder : IBuilder
///
IRequest Request { get; }
- ///
- /// Specifies the HTTP status code of the response.
- ///
- /// The HTTP status code of the response
- IResponseBuilder Status(ResponseStatus status);
-
- ///
- /// Specifies the HTTP status code of the response.
- ///
- /// The status code of the response
- /// The reason phrase of the response (such as "Not Found" for 404)
- IResponseBuilder Status(int status, string reason);
-
- ///
- /// Sets the given header field on the response. Changing HTTP
- /// protocol headers may cause incorrect behavior.
- ///
- /// The name of the header to be set
- /// The value of the header field
- IResponseBuilder Header(string key, string value);
-
- ///
- /// Sets the expiration date of the response.
- ///
- /// The expiration date of the response
- IResponseBuilder Expires(DateTime expiryDate);
-
- ///
- /// Sets the point in time when the requested resource has been
- /// modified last.
- ///
- /// The point in time when the requested resource has been modified last
- IResponseBuilder Modified(DateTime modificationDate);
-
- ///
- /// Adds the given cookie to the response.
- ///
- /// The cookie to be added
- IResponseBuilder Cookie(Cookie cookie);
-
///
/// Specifies the content to be sent to the client.
///
/// The content to be send to the client
IResponseBuilder Content(IResponseContent content);
- ///
- /// Specifies the content type of this response.
- ///
- /// The content type of this response
- IResponseBuilder Type(FlexibleContentType contentType);
-
///
/// Specifies the length of the content stream, if known.
///
/// The length of the content stream
IResponseBuilder Length(ulong length);
- ///
- /// Sets the encoding of the content.
- ///
- /// The encoding of the content
- IResponseBuilder Encoding(string encoding);
-
}
}
diff --git a/API/Protocol/IResponseModification.cs b/API/Protocol/IResponseModification.cs
new file mode 100644
index 00000000..8d0a6c7d
--- /dev/null
+++ b/API/Protocol/IResponseModification.cs
@@ -0,0 +1,68 @@
+using System;
+
+namespace GenHTTP.Api.Protocol
+{
+
+ ///
+ /// The protocol allowing to manipulate the response sent by
+ /// the server.
+ ///
+ /// The type of builder used as a return value
+ public interface IResponseModification
+ {
+
+ ///
+ /// Specifies the HTTP status code of the response.
+ ///
+ /// The HTTP status code of the response
+ T Status(ResponseStatus status);
+
+ ///
+ /// Specifies the HTTP status code of the response.
+ ///
+ /// The status code of the response
+ /// The reason phrase of the response (such as "Not Found" for 404)
+ T Status(int status, string reason);
+
+ ///
+ /// Sets the given header field on the response. Changing HTTP
+ /// protocol headers may cause incorrect behavior.
+ ///
+ /// The name of the header to be set
+ /// The value of the header field
+ T Header(string key, string value);
+
+ ///
+ /// Sets the expiration date of the response.
+ ///
+ /// The expiration date of the response
+ T Expires(DateTime expiryDate);
+
+ ///
+ /// Sets the point in time when the requested resource has been
+ /// modified last.
+ ///
+ /// The point in time when the requested resource has been modified last
+ T Modified(DateTime modificationDate);
+
+ ///
+ /// Adds the given cookie to the response.
+ ///
+ /// The cookie to be added
+ T Cookie(Cookie cookie);
+
+ ///
+ /// Specifies the content type of this response.
+ ///
+ /// The content type of this response
+ T Type(FlexibleContentType contentType);
+
+ ///
+ /// Sets the encoding of the content.
+ ///
+ /// The encoding of the content
+ T Encoding(string encoding);
+
+ }
+
+}
diff --git a/API/Protocol/ResponseStatus.cs b/API/Protocol/ResponseStatus.cs
index 9304f2ea..9c9a0f0d 100644
--- a/API/Protocol/ResponseStatus.cs
+++ b/API/Protocol/ResponseStatus.cs
@@ -194,7 +194,8 @@ public struct FlexibleResponseStatus
{ ResponseStatus.InsufficientStorage, "Insufficient Storage" },
{ ResponseStatus.LoopDetected, "Loop Detected" },
{ ResponseStatus.NotExtended, "Not Extended" },
- { ResponseStatus.NetworkAuthenticationRequired, "Network Authentication Required" }
+ { ResponseStatus.NetworkAuthenticationRequired, "Network Authentication Required" },
+ { ResponseStatus.Processing, "Processing" }
};
private static readonly Dictionary CODE_MAPPING = MAPPING.Keys.ToDictionary((k) => (int)k, (k) => k);
diff --git a/Modules/Controllers/Provider/ControllerHandler.cs b/Modules/Controllers/Provider/ControllerHandler.cs
index 97553931..79ebee04 100644
--- a/Modules/Controllers/Provider/ControllerHandler.cs
+++ b/Modules/Controllers/Provider/ControllerHandler.cs
@@ -52,7 +52,7 @@ private IEnumerable> AnalyzeMethods(Type type, Ser
var path = DeterminePath(method, arguments);
- yield return (parent) => new MethodHandler(parent, method, path, () => new T(), annotation, ResponseProvider.GetResponse, formats, injection);
+ yield return (parent) => new MethodHandler(parent, method, path, () => new T(), annotation, ResponseProvider.GetResponseAsync, formats, injection);
}
}
diff --git a/Modules/Functional/Provider/InlineHandler.cs b/Modules/Functional/Provider/InlineHandler.cs
index 54d632e3..d1383e77 100644
--- a/Modules/Functional/Provider/InlineHandler.cs
+++ b/Modules/Functional/Provider/InlineHandler.cs
@@ -44,7 +44,7 @@ private IEnumerable> AnalyzeMethods(List new MethodHandler(parent, function.Delegate.Method, path, () => target, function.Configuration, ResponseProvider.GetResponse, formats, injection);
+ yield return (parent) => new MethodHandler(parent, function.Delegate.Method, path, () => target, function.Configuration, ResponseProvider.GetResponseAsync, formats, injection);
}
}
diff --git a/Modules/Reflection/Adjustments.cs b/Modules/Reflection/Adjustments.cs
new file mode 100644
index 00000000..a91a7fc9
--- /dev/null
+++ b/Modules/Reflection/Adjustments.cs
@@ -0,0 +1,27 @@
+using System;
+
+using GenHTTP.Api.Protocol;
+
+namespace GenHTTP.Modules.Reflection
+{
+
+ internal static class Adjustments
+ {
+
+ ///
+ /// Allows to chain the execution of the given adjustments into
+ /// the given response builder.
+ ///
+ /// The response builder to be adjusted
+ /// The adjustments to be executed (if any)
+ /// The response builder to be chained
+ internal static IResponseBuilder Adjust(this IResponseBuilder builder, Action? adjustments)
+ {
+ adjustments?.Invoke(builder);
+
+ return builder;
+ }
+
+ }
+
+}
diff --git a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj
index e55f5b12..515f2463 100644
--- a/Modules/Reflection/GenHTTP.Modules.Reflection.csproj
+++ b/Modules/Reflection/GenHTTP.Modules.Reflection.csproj
@@ -25,8 +25,8 @@
true
snupkg
- true
- CS1591,CS1587,CS1572,CS1573
+ true
+ CS1591,CS1587,CS1572,CS1573
icon.png
@@ -43,7 +43,7 @@
-
+
diff --git a/Modules/Reflection/IResultWrapper.cs b/Modules/Reflection/IResultWrapper.cs
new file mode 100644
index 00000000..d8d646b9
--- /dev/null
+++ b/Modules/Reflection/IResultWrapper.cs
@@ -0,0 +1,27 @@
+using GenHTTP.Api.Protocol;
+
+namespace GenHTTP.Modules.Reflection
+{
+
+ ///
+ /// Allows the framework to unwrap
+ /// instances.
+ ///
+ internal interface IResultWrapper
+ {
+
+ ///
+ /// The actual result to be returned.
+ ///
+ object? Payload { get; }
+
+ ///
+ /// Performs the configured modifications to the response
+ /// on the given builder.
+ ///
+ /// The response builder to manipulate
+ void Apply(IResponseBuilder builder);
+
+ }
+
+}
diff --git a/Modules/Reflection/MethodHandler.cs b/Modules/Reflection/MethodHandler.cs
index a00735dd..d115826c 100644
--- a/Modules/Reflection/MethodHandler.cs
+++ b/Modules/Reflection/MethodHandler.cs
@@ -49,7 +49,7 @@ public sealed class MethodHandler : IHandler
private Func InstanceProvider { get; }
- private Func> ResponseProvider { get; }
+ private Func?, ValueTask> ResponseProvider { get; }
private SerializationRegistry Serialization { get; }
@@ -60,7 +60,7 @@ public sealed class MethodHandler : IHandler
#region Initialization
public MethodHandler(IHandler parent, MethodInfo method, MethodRouting routing, Func instanceProvider, IMethodConfiguration metaData,
- Func> responseProvider, SerializationRegistry serialization, InjectionRegistry injection)
+ Func?, ValueTask> responseProvider, SerializationRegistry serialization, InjectionRegistry injection)
{
Parent = parent;
@@ -88,7 +88,7 @@ public MethodHandler(IHandler parent, MethodInfo method, MethodRouting routing,
var result = Invoke(arguments);
- return await ResponseProvider(request, this, await UnwrapAsync(result));
+ return await ResponseProvider(request, this, await UnwrapAsync(result), null);
}
private async ValueTask GetArguments(IRequest request)
diff --git a/Modules/Reflection/ResponseProvider.cs b/Modules/Reflection/ResponseProvider.cs
index 347229ea..da66685d 100644
--- a/Modules/Reflection/ResponseProvider.cs
+++ b/Modules/Reflection/ResponseProvider.cs
@@ -36,22 +36,31 @@ public ResponseProvider(SerializationRegistry? serialization)
#region Functionality
- public async ValueTask GetResponse(IRequest request, IHandler handler, object? result)
+ public async ValueTask GetResponseAsync(IRequest request, IHandler handler, object? result, Action? adjustments = null)
{
// no result = 204
if (result is null)
{
return request.Respond()
.Status(ResponseStatus.NoContent)
+ .Adjust(adjustments)
.Build();
}
var type = result.GetType();
+ // unwrap the result if applicable
+ if (typeof(IResultWrapper).IsAssignableFrom(type))
+ {
+ var wrapped = (IResultWrapper)result;
+
+ return await GetResponseAsync(request, handler, wrapped.Payload, (b) => wrapped.Apply(b)).ConfigureAwait(false);
+ }
+
// response returned by the method
if (result is IResponseBuilder responseBuilder)
{
- return responseBuilder.Build();
+ return responseBuilder.Adjust(adjustments).Build();
}
if (result is IResponse response)
@@ -79,6 +88,7 @@ public ResponseProvider(SerializationRegistry? serialization)
var downloadResponse = request.Respond()
.Content(download, () => download.CalculateChecksumAsync())
.Type(ContentType.ApplicationForceDownload)
+ .Adjust(adjustments)
.Build();
return downloadResponse;
@@ -92,6 +102,7 @@ public ResponseProvider(SerializationRegistry? serialization)
return request.Respond()
.Content(result.ToString() ?? string.Empty)
.Type(ContentType.TextPlain)
+ .Adjust(adjustments)
.Build();
}
@@ -103,12 +114,14 @@ public ResponseProvider(SerializationRegistry? serialization)
throw new ProviderException(ResponseStatus.UnsupportedMediaType, "Requested format is not supported");
}
- var serializedResult = await serializer.SerializeAsync(request, result).ConfigureAwait(false);
+ var serializedResult = await serializer.SerializeAsync(request, result)
+ .ConfigureAwait(false);
- return serializedResult.Build();
+ return serializedResult.Adjust(adjustments)
+ .Build();
}
- throw new ProviderException(ResponseStatus.InternalServerError, "Result type must be one of: IHandlerBuilder, IHandler, IResponseBuilder, IResponse");
+ throw new ProviderException(ResponseStatus.InternalServerError, "Result type must be one of: IHandlerBuilder, IHandler, IResponseBuilder, IResponse, Stream");
}
#endregion
diff --git a/Modules/Reflection/Result.cs b/Modules/Reflection/Result.cs
new file mode 100644
index 00000000..960aec73
--- /dev/null
+++ b/Modules/Reflection/Result.cs
@@ -0,0 +1,180 @@
+using System;
+using System.Collections.Generic;
+
+using GenHTTP.Api.Protocol;
+
+namespace GenHTTP.Modules.Reflection
+{
+
+ ///
+ /// A result of a service invocation that wraps a given payload and
+ /// still allows to modify the response generated by the server.
+ ///
+ /// The type of payload wrapped by this result
+ ///
+ /// Useful to change response properties (such as the status code or headers)
+ /// while still keeping the content in place. Note that returning a result
+ /// will not change the serialized outcome of the service method, it will be
+ /// the same as it would be when you would just return the payload itself.
+ ///
+ public class Result : IResultWrapper, IResponseModification>
+ {
+ private FlexibleResponseStatus? _Status;
+
+ private Dictionary? _Headers;
+
+ private DateTime? _Expires;
+
+ private DateTime? _Modified;
+
+ private List? _Cookies;
+
+ private FlexibleContentType? _ContentType;
+
+ private string? _Encoding;
+
+ #region Get-/Setters
+
+ ///
+ /// The actual data to be returned to the client.
+ ///
+ public T? Payload { get; }
+
+ object? IResultWrapper.Payload => Payload;
+
+ #endregion
+
+ #region Initialization
+
+ ///
+ /// Creates a new result with the given payload.
+ ///
+ /// The payload to be returned to the client
+ public Result(T? payload)
+ {
+ Payload = payload;
+ }
+
+ #endregion
+
+ #region Functionality
+
+ ///
+ public Result Status(ResponseStatus status)
+ {
+ _Status = new(status);
+ return this;
+ }
+
+ ///
+ public Result Status(int status, string reason)
+ {
+ _Status = new FlexibleResponseStatus(status, reason);
+ return this;
+ }
+
+ ///
+ public Result Header(string key, string value)
+ {
+ if (_Headers == null)
+ {
+ _Headers = new();
+ }
+
+ _Headers[key] = value;
+
+ return this;
+ }
+
+ ///
+ public Result Expires(DateTime expiryDate)
+ {
+ _Expires = expiryDate;
+ return this;
+ }
+
+ ///
+ public Result Modified(DateTime modificationDate)
+ {
+ _Modified = modificationDate;
+ return this;
+ }
+
+ ///
+ public Result Cookie(Cookie cookie)
+ {
+ if (_Cookies == null)
+ {
+ _Cookies = new();
+ }
+
+ _Cookies.Add(cookie);
+
+ return this;
+ }
+
+ ///
+ public Result Type(FlexibleContentType contentType)
+ {
+ _ContentType = contentType;
+ return this;
+ }
+
+ ///
+ public Result Encoding(string encoding)
+ {
+ _Encoding = encoding;
+ return this;
+ }
+
+ void IResultWrapper.Apply(IResponseBuilder builder)
+ {
+ if (_Status != null)
+ {
+ var value = _Status.Value;
+
+ builder.Status(value.RawStatus, value.Phrase);
+ }
+
+ if (_Headers != null)
+ {
+ foreach (var kv in _Headers)
+ {
+ builder.Header(kv.Key, kv.Value);
+ }
+ }
+
+ if (_Expires != null)
+ {
+ builder.Expires(_Expires.Value);
+ }
+
+ if (_Modified != null)
+ {
+ builder.Modified(_Modified.Value);
+ }
+
+ if (_Cookies != null)
+ {
+ foreach (var cookie in _Cookies)
+ {
+ builder.Cookie(cookie);
+ }
+ }
+
+ if (_ContentType is not null)
+ {
+ builder.Type(_ContentType);
+ }
+
+ if (_Encoding != null)
+ {
+ builder.Encoding(_Encoding);
+ }
+ }
+
+ #endregion
+
+ }
+
+}
diff --git a/Modules/Webservices/Provider/ServiceResourceRouter.cs b/Modules/Webservices/Provider/ServiceResourceRouter.cs
index c2d05e5d..d87388d3 100644
--- a/Modules/Webservices/Provider/ServiceResourceRouter.cs
+++ b/Modules/Webservices/Provider/ServiceResourceRouter.cs
@@ -51,7 +51,7 @@ private IEnumerable> AnalyzeMethods(Type type, Ser
{
var path = PathArguments.Route(attribute.Path);
- yield return (parent) => new MethodHandler(parent, method, path, () => Instance, attribute, ResponseProvider.GetResponse, serialization, injection);
+ yield return (parent) => new MethodHandler(parent, method, path, () => Instance, attribute, ResponseProvider.GetResponseAsync, serialization, injection);
}
}
}
diff --git a/Testing/Acceptance/Engine/ContentTests.cs b/Testing/Acceptance/Engine/ContentTests.cs
index f64fabd9..4101dfd2 100644
--- a/Testing/Acceptance/Engine/ContentTests.cs
+++ b/Testing/Acceptance/Engine/ContentTests.cs
@@ -76,7 +76,7 @@ public async Task TestResources()
using var response = await runner.GetResponseAsync();
- Assert.IsTrue((await response.GetContent()).Contains("Error.html"));
+ Assert.IsTrue((await response.GetContentAsync()).Contains("Error.html"));
}
[TestMethod]
@@ -87,7 +87,7 @@ public async Task TestDirectoryListing()
using var response = await runner.GetResponseAsync();
- Assert.IsTrue((await response.GetContent()).Contains("Error.html"));
+ Assert.IsTrue((await response.GetContentAsync()).Contains("Error.html"));
}
[TestMethod]
@@ -98,7 +98,7 @@ public async Task TestSinglePageApplication()
using var response = await runner.GetResponseAsync();
- Assert.IsTrue((await response.GetContent()).Contains("Error.html"));
+ Assert.IsTrue((await response.GetContentAsync()).Contains("Error.html"));
}
[TestMethod]
@@ -108,7 +108,7 @@ public async Task TestWebsite()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("custom.js", content);
AssertX.Contains("custom.css", content);
diff --git a/Testing/Acceptance/Engine/DeveloperModeTests.cs b/Testing/Acceptance/Engine/DeveloperModeTests.cs
index bd724bcf..47fe852f 100644
--- a/Testing/Acceptance/Engine/DeveloperModeTests.cs
+++ b/Testing/Acceptance/Engine/DeveloperModeTests.cs
@@ -50,7 +50,7 @@ public async Task TestExceptionsWithTrace()
using var response = await runner.GetResponseAsync();
- Assert.IsTrue((await response.GetContent()).Contains("Exception"));
+ Assert.IsTrue((await response.GetContentAsync()).Contains("Exception"));
}
///
@@ -66,7 +66,7 @@ public async Task TestExceptionsWithNoTrace()
using var response = await runner.GetResponseAsync();
- Assert.IsFalse((await response.GetContent()).Contains("Exception"));
+ Assert.IsFalse((await response.GetContentAsync()).Contains("Exception"));
}
}
diff --git a/Testing/Acceptance/Engine/EncodingTests.cs b/Testing/Acceptance/Engine/EncodingTests.cs
index 93c05e6d..d8b7496a 100644
--- a/Testing/Acceptance/Engine/EncodingTests.cs
+++ b/Testing/Acceptance/Engine/EncodingTests.cs
@@ -24,7 +24,7 @@ public async Task TestUtf8DefaultEncoding()
using var response = await runner.GetResponseAsync("/utf8");
- Assert.AreEqual("From GenHTTP with ❤", await response.GetContent());
+ Assert.AreEqual("From GenHTTP with ❤", await response.GetContentAsync());
}
}
diff --git a/Testing/Acceptance/Engine/ParserTests.cs b/Testing/Acceptance/Engine/ParserTests.cs
index 4d6c696a..07595e01 100644
--- a/Testing/Acceptance/Engine/ParserTests.cs
+++ b/Testing/Acceptance/Engine/ParserTests.cs
@@ -70,7 +70,7 @@ public async Task TestEndodedUri()
using var respose = await runner.GetResponseAsync("/söme/ürl/with specialities/");
- Assert.AreEqual("/söme/ürl/with specialities/", await respose.GetContent());
+ Assert.AreEqual("/söme/ürl/with specialities/", await respose.GetContentAsync());
}
[TestMethod]
@@ -80,7 +80,7 @@ public async Task TestEncodedQuery()
using var respose = await runner.GetResponseAsync("/?söme key=💕");
- Assert.AreEqual("söme key=💕", await respose.GetContent());
+ Assert.AreEqual("söme key=💕", await respose.GetContentAsync());
}
[TestMethod]
@@ -90,7 +90,7 @@ public async Task TestMultipleSlashes()
using var respose = await runner.GetResponseAsync("//one//two//three//");
- Assert.AreEqual("//one//two//three//", await respose.GetContent());
+ Assert.AreEqual("//one//two//three//", await respose.GetContentAsync());
}
[TestMethod]
@@ -100,7 +100,7 @@ public async Task TestEmptyQuery()
using var respose = await runner.GetResponseAsync("/?");
- Assert.AreEqual(string.Empty, await respose.GetContent());
+ Assert.AreEqual(string.Empty, await respose.GetContentAsync());
}
[TestMethod]
@@ -110,7 +110,7 @@ public async Task TestUnkeyedQuery()
using var respose = await runner.GetResponseAsync("/?query");
- Assert.AreEqual("query=", await respose.GetContent());
+ Assert.AreEqual("query=", await respose.GetContentAsync());
}
[TestMethod]
@@ -120,7 +120,7 @@ public async Task TestQueryWithSlashes()
using var respose = await runner.GetResponseAsync("/?key=/one/two");
- Assert.AreEqual("key=/one/two", await respose.GetContent());
+ Assert.AreEqual("key=/one/two", await respose.GetContentAsync());
}
[TestMethod]
@@ -130,7 +130,7 @@ public async Task TestQueryWithSpaces()
using var respose = await runner.GetResponseAsync("/?path=/Some+Folder/With%20Subfolders/");
- Assert.AreEqual("path=/Some+Folder/With Subfolders/", await respose.GetContent());
+ Assert.AreEqual("path=/Some+Folder/With Subfolders/", await respose.GetContentAsync());
}
}
diff --git a/Testing/Acceptance/Engine/ProtocolTests.cs b/Testing/Acceptance/Engine/ProtocolTests.cs
index 88785825..d52bce93 100644
--- a/Testing/Acceptance/Engine/ProtocolTests.cs
+++ b/Testing/Acceptance/Engine/ProtocolTests.cs
@@ -120,7 +120,7 @@ public async Task TestPutLarge()
using var response = await runner.GetResponseAsync(request);
- Assert.AreEqual("1310720", await response.GetContent());
+ Assert.AreEqual("1310720", await response.GetContentAsync());
}
}
diff --git a/Testing/Acceptance/Engine/ResponseTests.cs b/Testing/Acceptance/Engine/ResponseTests.cs
index 1a9b2d02..ef6dd19f 100644
--- a/Testing/Acceptance/Engine/ResponseTests.cs
+++ b/Testing/Acceptance/Engine/ResponseTests.cs
@@ -75,7 +75,7 @@ public async Task TestProperties()
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Hello World", await response.GetContent());
+ Assert.AreEqual("Hello World", await response.GetContentAsync());
Assert.AreEqual("text/x-custom", response.GetContentHeader("Content-Type"));
Assert.AreEqual(provider.Modified.WithoutMS(), response.Content.Headers.LastModified);
diff --git a/Testing/Acceptance/Modules/Authentication/BasicAuthenticationTests.cs b/Testing/Acceptance/Modules/Authentication/BasicAuthenticationTests.cs
index a97000ce..34381ec6 100644
--- a/Testing/Acceptance/Modules/Authentication/BasicAuthenticationTests.cs
+++ b/Testing/Acceptance/Modules/Authentication/BasicAuthenticationTests.cs
@@ -40,7 +40,7 @@ public async Task TestValidUser()
using var response = await GetResponse(runner, "user", "password");
- Assert.AreEqual("user", await response.GetContent());
+ Assert.AreEqual("user", await response.GetContentAsync());
}
[TestMethod]
@@ -77,7 +77,7 @@ public async Task TestCustomUser()
using var response = await GetResponse(runner, "_", "_");
- Assert.AreEqual("my", await response.GetContent());
+ Assert.AreEqual("my", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/Authentication/UserInjectionTests.cs b/Testing/Acceptance/Modules/Authentication/UserInjectionTests.cs
index a6eef0c3..b2b872bf 100644
--- a/Testing/Acceptance/Modules/Authentication/UserInjectionTests.cs
+++ b/Testing/Acceptance/Modules/Authentication/UserInjectionTests.cs
@@ -28,7 +28,7 @@ public async Task TestUserInjected()
using var response = await runner.GetResponseAsync(client: client);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("abc", await response.GetContent());
+ Assert.AreEqual("abc", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/Controllers/ActionTests.cs b/Testing/Acceptance/Modules/Controllers/ActionTests.cs
index 87fdd0a8..a4daaf45 100644
--- a/Testing/Acceptance/Modules/Controllers/ActionTests.cs
+++ b/Testing/Acceptance/Modules/Controllers/ActionTests.cs
@@ -87,7 +87,7 @@ public async Task TestIndex()
using var response = await runner.GetResponseAsync("/t/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
}
[TestMethod]
@@ -98,7 +98,7 @@ public async Task TestAction()
using var response = await runner.GetResponseAsync("/t/action/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Action", await response.GetContent());
+ Assert.AreEqual("Action", await response.GetContentAsync());
}
[TestMethod]
@@ -109,7 +109,7 @@ public async Task TestActionWithQuery()
using var response = await runner.GetResponseAsync("/t/action/?query=0815");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("815", await response.GetContent());
+ Assert.AreEqual("815", await response.GetContentAsync());
}
[TestMethod]
@@ -130,7 +130,7 @@ public async Task TestActionWithQueryFromBody()
using var response = await runner.GetResponseAsync(request);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Action test", await response.GetContent());
+ Assert.AreEqual("Action test", await response.GetContentAsync());
}
[TestMethod]
@@ -148,7 +148,7 @@ public async Task TestActionWithBody()
using var response = await runner.GetResponseAsync(request);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("FieldData", await response.GetContent());
+ Assert.AreEqual("FieldData", await response.GetContentAsync());
}
[TestMethod]
@@ -159,7 +159,7 @@ public async Task TestActionWithParameter()
using var response = await runner.GetResponseAsync("/t/simple-action/4711/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("4711", await response.GetContent());
+ Assert.AreEqual("4711", await response.GetContentAsync());
}
[TestMethod]
@@ -180,7 +180,7 @@ public async Task TestActionWithMixedParameters()
using var response = await runner.GetResponseAsync("/t/complex-action/1/2/?three=3");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("6", await response.GetContent());
+ Assert.AreEqual("6", await response.GetContentAsync());
}
[TestMethod]
@@ -211,7 +211,7 @@ public async Task TestHypenCasing()
using var response = await runner.GetResponseAsync("/t/hypen-casing-99/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("OK", await response.GetContent());
+ Assert.AreEqual("OK", await response.GetContentAsync());
}
[TestMethod]
@@ -222,7 +222,7 @@ public async Task TestIndexController()
using var response = await runner.GetResponseAsync("/simple-action/4711/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("4711", await response.GetContent());
+ Assert.AreEqual("4711", await response.GetContentAsync());
}
#endregion
diff --git a/Testing/Acceptance/Modules/Controllers/ResultTypeTests.cs b/Testing/Acceptance/Modules/Controllers/ResultTypeTests.cs
index a9e43930..cc81f58b 100644
--- a/Testing/Acceptance/Modules/Controllers/ResultTypeTests.cs
+++ b/Testing/Acceptance/Modules/Controllers/ResultTypeTests.cs
@@ -58,7 +58,7 @@ public async Task ControllerMayReturnHandlerBuilder()
using var response = await runner.GetResponseAsync("/t/handler-builder/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("HandlerBuilder", await response.GetContent());
+ Assert.AreEqual("HandlerBuilder", await response.GetContentAsync());
}
[TestMethod]
@@ -69,7 +69,7 @@ public async Task ControllerMayReturnHandler()
using var response = await runner.GetResponseAsync("/t/handler/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Handler", await response.GetContent());
+ Assert.AreEqual("Handler", await response.GetContentAsync());
}
[TestMethod]
@@ -80,7 +80,7 @@ public async Task ControllerMayReturnResponseBuilder()
using var response = await runner.GetResponseAsync("/t/response-builder/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("ResponseBuilder", await response.GetContent());
+ Assert.AreEqual("ResponseBuilder", await response.GetContentAsync());
}
[TestMethod]
@@ -91,7 +91,7 @@ public async Task ControllerMayReturnResponse()
using var response = await runner.GetResponseAsync("/t/response/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Response", await response.GetContent());
+ Assert.AreEqual("Response", await response.GetContentAsync());
}
#endregion
diff --git a/Testing/Acceptance/Modules/Controllers/RoutingTests.cs b/Testing/Acceptance/Modules/Controllers/RoutingTests.cs
index 514b8cf1..1fa85cd4 100644
--- a/Testing/Acceptance/Modules/Controllers/RoutingTests.cs
+++ b/Testing/Acceptance/Modules/Controllers/RoutingTests.cs
@@ -119,7 +119,7 @@ public async Task TestAppenders()
using var response = await runner.GetResponseAsync("/r/appenders/1/test/");
- Assert.AreEqual("/r/appenders/1/test/", await response.GetContent());
+ Assert.AreEqual("/r/appenders/1/test/", await response.GetContentAsync());
}
[TestMethod]
@@ -129,7 +129,7 @@ public async Task TestNested()
using var response = await runner.GetResponseAsync("/r/nested/1/test/inner");
- Assert.AreEqual("/r/nested/1/test/inner", await response.GetContent());
+ Assert.AreEqual("/r/nested/1/test/inner", await response.GetContentAsync());
}
///
@@ -143,7 +143,7 @@ public async Task TestInner()
using var response = await runner.GetResponseAsync("/r/inner-controller/1/2/inner-controller/3/4/appenders/5/6/");
- Assert.AreEqual("/r/inner-controller/1/2/inner-controller/3/4/appenders/5/6/", await response.GetContent());
+ Assert.AreEqual("/r/inner-controller/1/2/inner-controller/3/4/appenders/5/6/", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/ConversionTests.cs b/Testing/Acceptance/Modules/ConversionTests.cs
index d9bda1c3..3f3af7b4 100644
--- a/Testing/Acceptance/Modules/ConversionTests.cs
+++ b/Testing/Acceptance/Modules/ConversionTests.cs
@@ -130,7 +130,7 @@ public ConversionHandler(ISerializationFormat format, IHandler parent)
using var response = await runner.GetResponseAsync(request);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual(serialized, await response.GetContent());
+ Assert.AreEqual(serialized, await response.GetContentAsync());
}
#endregion
diff --git a/Testing/Acceptance/Modules/ErrorHandling/CustomErrorMapperTests.cs b/Testing/Acceptance/Modules/ErrorHandling/CustomErrorMapperTests.cs
index a3952f75..3d3c1c2e 100644
--- a/Testing/Acceptance/Modules/ErrorHandling/CustomErrorMapperTests.cs
+++ b/Testing/Acceptance/Modules/ErrorHandling/CustomErrorMapperTests.cs
@@ -58,7 +58,7 @@ public async Task Test404Mapped()
using var runner = TestHost.Run(test);
using var response = await runner.GetResponseAsync("/");
- Assert.AreEqual("404", await response.GetContent());
+ Assert.AreEqual("404", await response.GetContentAsync());
}
[TestMethod]
@@ -73,7 +73,7 @@ public async Task TestExceptionMapped()
using var runner = TestHost.Run(test);
using var response = await runner.GetResponseAsync("/");
- Assert.AreEqual("5", await response.GetContent());
+ Assert.AreEqual("5", await response.GetContentAsync());
}
#endregion
diff --git a/Testing/Acceptance/Modules/Functional/InlineTests.cs b/Testing/Acceptance/Modules/Functional/InlineTests.cs
index 027378cf..2e5c8486 100644
--- a/Testing/Acceptance/Modules/Functional/InlineTests.cs
+++ b/Testing/Acceptance/Modules/Functional/InlineTests.cs
@@ -36,7 +36,7 @@ public async Task TestGetRoot()
using var response = await host.GetResponseAsync();
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
@@ -46,7 +46,7 @@ public async Task TestGetPath()
using var response = await host.GetResponseAsync("/blubb");
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
@@ -56,7 +56,7 @@ public async Task TestGetQueryParam()
using var response = await host.GetResponseAsync("/?param=41");
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
@@ -66,7 +66,7 @@ public async Task TestGetEmptyBooleanQueryParam()
using var response = await host.GetResponseAsync("/?param=");
- Assert.AreEqual("False", await response.GetContent());
+ Assert.AreEqual("False", await response.GetContentAsync());
}
[TestMethod]
@@ -76,7 +76,7 @@ public async Task TestGetEmptyDoubleQueryParam()
using var response = await host.GetResponseAsync("/?param=");
- Assert.AreEqual("0", await response.GetContent());
+ Assert.AreEqual("0", await response.GetContentAsync());
}
[TestMethod]
@@ -86,7 +86,7 @@ public async Task TestGetEmptyStringQueryParam()
using var response = await host.GetResponseAsync("/?param=");
- Assert.AreEqual("", await response.GetContent());
+ Assert.AreEqual("", await response.GetContentAsync());
}
[TestMethod]
@@ -96,7 +96,7 @@ public async Task TestGetEmptyEnumQueryParam()
using var response = await host.GetResponseAsync("/?param=");
- Assert.AreEqual("One", await response.GetContent());
+ Assert.AreEqual("One", await response.GetContentAsync());
}
[TestMethod]
@@ -106,7 +106,7 @@ public async Task TestGetPathParam()
using var response = await host.GetResponseAsync("/41");
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
@@ -131,7 +131,7 @@ public async Task TestRaw()
using var response = await host.GetResponseAsync();
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
@@ -141,7 +141,7 @@ public async Task TestStream()
using var response = await host.GetResponseAsync();
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
@@ -151,7 +151,7 @@ public async Task TestJson()
using var response = await host.GetResponseAsync();
- Assert.AreEqual("{\"string\":\"42\",\"int\":42,\"double\":42}", await response.GetContent());
+ Assert.AreEqual("{\"string\":\"42\",\"int\":42,\"double\":42}", await response.GetContentAsync());
}
[TestMethod]
@@ -167,7 +167,7 @@ public async Task TestPostJson()
using var response = await host.GetResponseAsync(request);
- Assert.AreEqual("{\"string\":\"42\",\"int\":42,\"double\":42}", await response.GetContent());
+ Assert.AreEqual("{\"string\":\"42\",\"int\":42,\"double\":42}", await response.GetContentAsync());
}
[TestMethod]
@@ -186,7 +186,7 @@ public async Task TestAsync()
using var response = await host.GetResponseAsync();
- Assert.AreEqual("42", await response.GetContent());
+ Assert.AreEqual("42", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/IO/ContentTests.cs b/Testing/Acceptance/Modules/IO/ContentTests.cs
index d2ec1307..68739dfd 100644
--- a/Testing/Acceptance/Modules/IO/ContentTests.cs
+++ b/Testing/Acceptance/Modules/IO/ContentTests.cs
@@ -20,7 +20,7 @@ public async Task TestContent()
using var response = await runner.GetResponseAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/IO/DownloadTests.cs b/Testing/Acceptance/Modules/IO/DownloadTests.cs
index 2c697373..a3221887 100644
--- a/Testing/Acceptance/Modules/IO/DownloadTests.cs
+++ b/Testing/Acceptance/Modules/IO/DownloadTests.cs
@@ -24,7 +24,7 @@ public async Task TestDownload()
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("This is text!", await response.GetContent());
+ Assert.AreEqual("This is text!", await response.GetContentAsync());
Assert.AreEqual("text/plain", response.GetContentHeader("Content-Type"));
}
diff --git a/Testing/Acceptance/Modules/IO/RangeTests.cs b/Testing/Acceptance/Modules/IO/RangeTests.cs
index bb043521..01a05805 100644
--- a/Testing/Acceptance/Modules/IO/RangeTests.cs
+++ b/Testing/Acceptance/Modules/IO/RangeTests.cs
@@ -20,7 +20,7 @@ public async Task TestRangesAreOptional()
using var response = await GetResponse(null);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual(CONTENT, await response.GetContent());
+ Assert.AreEqual(CONTENT, await response.GetContentAsync());
}
[TestMethod]
@@ -29,7 +29,7 @@ public async Task TestFullRangeIsSatisfied()
using var response = await GetResponse("bytes=1-8");
await response.AssertStatusAsync(HttpStatusCode.PartialContent);
- Assert.AreEqual("12345678", await response.GetContent());
+ Assert.AreEqual("12345678", await response.GetContentAsync());
Assert.AreEqual("bytes 1-8/10", response.GetContentHeader("Content-Range"));
}
@@ -39,7 +39,7 @@ public async Task TestRangeFromStartIsSatisfied()
using var response = await GetResponse("bytes=4-");
await response.AssertStatusAsync(HttpStatusCode.PartialContent);
- Assert.AreEqual("456789", await response.GetContent());
+ Assert.AreEqual("456789", await response.GetContentAsync());
Assert.AreEqual("bytes 4-9/10", response.GetContentHeader("Content-Range"));
}
@@ -49,7 +49,7 @@ public async Task TestRangeFromEndIsSatisfied()
using var response = await GetResponse("bytes=-4");
await response.AssertStatusAsync(HttpStatusCode.PartialContent);
- Assert.AreEqual("6789", await response.GetContent());
+ Assert.AreEqual("6789", await response.GetContentAsync());
Assert.AreEqual("bytes 6-9/10", response.GetContentHeader("Content-Range"));
}
@@ -59,7 +59,7 @@ public async Task TestSingleRangeIsSatisfied()
using var response = await GetResponse("bytes=1-1");
await response.AssertStatusAsync(HttpStatusCode.PartialContent);
- Assert.AreEqual("1", await response.GetContent());
+ Assert.AreEqual("1", await response.GetContentAsync());
Assert.AreEqual("bytes 1-1/10", response.GetContentHeader("Content-Range"));
}
@@ -127,7 +127,7 @@ public async Task TestRangesIgnoredOnPostRequests()
using var response = await GetResponse("bytes=1-8", HttpMethod.Post);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual(CONTENT, await response.GetContent());
+ Assert.AreEqual(CONTENT, await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/IO/ResourceTest.cs b/Testing/Acceptance/Modules/IO/ResourceTest.cs
index c41ac9c4..bfffd6c2 100644
--- a/Testing/Acceptance/Modules/IO/ResourceTest.cs
+++ b/Testing/Acceptance/Modules/IO/ResourceTest.cs
@@ -91,10 +91,10 @@ public async Task TestAssemblyResourceRouting()
using var runner = TestHost.Run(layout);
using var f1 = await runner.GetResponseAsync("/1");
- Assert.AreEqual("This is text!", await f1.GetContent());
+ Assert.AreEqual("This is text!", await f1.GetContentAsync());
using var f2 = await runner.GetResponseAsync("/2");
- Assert.AreEqual("This is other text!", await f2.GetContent());
+ Assert.AreEqual("This is other text!", await f2.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/IO/ResourcesTests.cs b/Testing/Acceptance/Modules/IO/ResourcesTests.cs
index c887d655..1574c932 100644
--- a/Testing/Acceptance/Modules/IO/ResourcesTests.cs
+++ b/Testing/Acceptance/Modules/IO/ResourcesTests.cs
@@ -22,7 +22,7 @@ public async Task TestFileDownload()
using var response = await runner.GetResponseAsync("/Resources/File.txt");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("This is text!", await response.GetContent());
+ Assert.AreEqual("This is text!", await response.GetContentAsync());
}
[TestMethod]
@@ -33,7 +33,7 @@ public async Task TestSubdirectoryFileDownload()
using var response = await runner.GetResponseAsync("/Resources/Subdirectory/AnotherFile.txt");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("This is another text!", await response.GetContent());
+ Assert.AreEqual("This is another text!", await response.GetContentAsync());
}
[TestMethod]
@@ -64,7 +64,7 @@ public async Task TestRootDownload()
using var response = await runner.GetResponseAsync("/File.txt");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("This is text!", await response.GetContent());
+ Assert.AreEqual("This is text!", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/LayoutTests.cs b/Testing/Acceptance/Modules/LayoutTests.cs
index 909e91d3..aa9b026a 100644
--- a/Testing/Acceptance/Modules/LayoutTests.cs
+++ b/Testing/Acceptance/Modules/LayoutTests.cs
@@ -28,7 +28,7 @@ public async Task TestGetIndex()
using var response = await runner.GetResponseAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
using var notFound = await runner.GetResponseAsync("/notfound");
@@ -50,7 +50,7 @@ public async Task TestDefaultContent()
using var response = await runner.GetResponseAsync(path);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
}
}
@@ -69,7 +69,7 @@ public async Task TestRedirect()
using var response = await runner.GetResponseAsync("/section/");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
using var redirected = await runner.GetResponseAsync("/section");
diff --git a/Testing/Acceptance/Modules/ListingTests.cs b/Testing/Acceptance/Modules/ListingTests.cs
index 1882d1f7..ee6ccc4a 100644
--- a/Testing/Acceptance/Modules/ListingTests.cs
+++ b/Testing/Acceptance/Modules/ListingTests.cs
@@ -27,7 +27,7 @@ public async Task TestGetMainListing()
using var response = await runner.GetResponseAsync("/");
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("Subdirectory", content);
AssertX.Contains("With%20Spaces", content);
@@ -48,7 +48,7 @@ public async Task TestGetSubdirectory()
using var response = await runner.GetResponseAsync("/Subdirectory/");
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("..", content);
}
@@ -65,7 +65,7 @@ public async Task TestDownload()
using var response = await runner.GetResponseAsync("/my.txt");
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/LoadBalancerTests.cs b/Testing/Acceptance/Modules/LoadBalancerTests.cs
index 4253e40c..fbd058a1 100644
--- a/Testing/Acceptance/Modules/LoadBalancerTests.cs
+++ b/Testing/Acceptance/Modules/LoadBalancerTests.cs
@@ -28,7 +28,7 @@ public async Task TestProxy()
using var response = await runner.GetResponseAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Proxy!", await response.GetContent());
+ Assert.AreEqual("Proxy!", await response.GetContentAsync());
}
[TestMethod]
@@ -56,7 +56,7 @@ public async Task TestCustomHandler()
using var response = await runner.GetResponseAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("My Content!", await response.GetContent());
+ Assert.AreEqual("My Content!", await response.GetContentAsync());
}
[TestMethod]
@@ -70,7 +70,7 @@ public async Task TestPriorities()
using var response = await runner.GetResponseAsync();
- Assert.AreEqual("Prio A", await response.GetContent());
+ Assert.AreEqual("Prio A", await response.GetContentAsync());
}
[TestMethod]
@@ -85,7 +85,7 @@ public async Task TestMultiplePriorities()
using var response = await runner.GetResponseAsync();
- AssertX.StartsWith("Prio A", await response.GetContent());
+ AssertX.StartsWith("Prio A", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/PageTests.cs b/Testing/Acceptance/Modules/PageTests.cs
index e4df784d..68793870 100644
--- a/Testing/Acceptance/Modules/PageTests.cs
+++ b/Testing/Acceptance/Modules/PageTests.cs
@@ -60,7 +60,7 @@ public async Task TestStringPage()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
Assert.AreNotEqual("Hello World!", content);
AssertX.Contains("Hello World!", content);
@@ -84,7 +84,7 @@ public async Task TestMarkdownPage()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("Hello World! ", content);
@@ -111,7 +111,7 @@ public async Task TestRendering()
using var response = await runner.GetResponseAsync("/page");
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
Assert.AreNotEqual("Hello World!", content);
AssertX.Contains("Hello World!", content);
@@ -129,7 +129,7 @@ public async Task TestContentInfo()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
@@ -146,7 +146,7 @@ public async Task TestNoContentInfo()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
@@ -182,7 +182,7 @@ public async Task TestRouting()
await response.AssertStatusAsync(HttpStatusCode.OK);
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("https://google.de|../res/123|../../other/456/|./relative", content);
}
@@ -207,7 +207,7 @@ public async Task TestRoutingToPath()
using var response = await runner.GetResponseAsync("/page");
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
await response.AssertStatusAsync(HttpStatusCode.OK);
AssertX.Contains("/test/1", content);
diff --git a/Testing/Acceptance/Modules/Pages/CombinedPageTest.cs b/Testing/Acceptance/Modules/Pages/CombinedPageTest.cs
index c0406e9a..d4f0018a 100644
--- a/Testing/Acceptance/Modules/Pages/CombinedPageTest.cs
+++ b/Testing/Acceptance/Modules/Pages/CombinedPageTest.cs
@@ -27,7 +27,7 @@ public async Task TestMetaData()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("My Page", content);
AssertX.Contains("My Description", content);
@@ -45,7 +45,7 @@ public async Task TestPlainText()
using var response = await runner.GetResponseAsync();
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("Static Content", content);
}
@@ -64,7 +64,7 @@ public async Task TestRenderingEngines()
using var response = await runner.GetResponseAsync("/page");
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
AssertX.Contains("Scriban at /page", content);
AssertX.Contains("Razor at /page", content);
diff --git a/Testing/Acceptance/Modules/Razor/ConfigurationTests.cs b/Testing/Acceptance/Modules/Razor/ConfigurationTests.cs
index a27c9abf..f199a196 100644
--- a/Testing/Acceptance/Modules/Razor/ConfigurationTests.cs
+++ b/Testing/Acceptance/Modules/Razor/ConfigurationTests.cs
@@ -25,7 +25,7 @@ public async Task TestLinq()
using var response = await runner.GetResponseAsync();
- AssertX.Contains("100 = 100", await response.GetContent());
+ AssertX.Contains("100 = 100", await response.GetContentAsync());
}
}
diff --git a/Testing/Acceptance/Modules/Reflection/ResultTests.cs b/Testing/Acceptance/Modules/Reflection/ResultTests.cs
new file mode 100644
index 00000000..93e7fd11
--- /dev/null
+++ b/Testing/Acceptance/Modules/Reflection/ResultTests.cs
@@ -0,0 +1,74 @@
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+using GenHTTP.Api.Protocol;
+using GenHTTP.Modules.Functional;
+using GenHTTP.Modules.Reflection;
+
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace GenHTTP.Testing.Acceptance.Modules.Reflection
+{
+
+ [TestClass]
+ public sealed class ResultTests
+ {
+
+ #region Supporting data structures
+
+ public record class MyPayload(string Message);
+
+ #endregion
+
+ #region Tests
+
+ [TestMethod]
+ public async Task TestResponseCanBeModified()
+ {
+ var result = new Result(new("Hello World!"))
+ .Status(ResponseStatus.Accepted)
+ .Status(202, "Accepted Custom")
+ .Type(new(ContentType.TextRichText))
+ .Modified(DateTime.UtcNow)
+ .Expires(DateTime.UtcNow)
+ .Header("X-Custom", "Value")
+ .Cookie(new("Cookie", "Value"))
+ .Encoding("my-encoding");
+
+ var inline = Inline.Create()
+ .Get(() => result);
+
+ using var runner = TestHost.Run(inline);
+
+ using var response = await runner.GetResponseAsync();
+
+ await response.AssertStatusAsync(HttpStatusCode.Accepted);
+
+ Assert.AreEqual("Value", response.GetHeader("X-Custom"));
+ }
+
+ [TestMethod]
+ public async Task TestStreamsCanBeWrapped()
+ {
+ var stream = new MemoryStream(Encoding.UTF8.GetBytes("Hello World!"));
+
+ var inline = Inline.Create()
+ .Get(() => new Result(stream).Status(ResponseStatus.Created));
+
+ using var runner = TestHost.Run(inline);
+
+ using var response = await runner.GetResponseAsync();
+
+ await response.AssertStatusAsync(HttpStatusCode.Created);
+
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
+ }
+
+ #endregion
+
+ }
+
+}
diff --git a/Testing/Acceptance/Modules/ReverseProxyTests.cs b/Testing/Acceptance/Modules/ReverseProxyTests.cs
index 823e332f..e5dd57a4 100644
--- a/Testing/Acceptance/Modules/ReverseProxyTests.cs
+++ b/Testing/Acceptance/Modules/ReverseProxyTests.cs
@@ -163,7 +163,7 @@ public async Task TestBasics()
var runner = setup.Runner;
using var response = await runner.GetResponseAsync();
- Assert.AreEqual("Hello World!", await response.GetContent());
+ Assert.AreEqual("Hello World!", await response.GetContentAsync());
}
[TestMethod]
@@ -280,7 +280,7 @@ public async Task TestPost()
using var response = await runner.GetResponseAsync(request);
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Input", await response.GetContent());
+ Assert.AreEqual("Input", await response.GetContentAsync());
}
[TestMethod]
@@ -294,13 +294,13 @@ public async Task TestPathing()
var runner = setup.Runner;
using var r1 = await runner.GetResponseAsync("/");
- Assert.AreEqual("/", await r1.GetContent());
+ Assert.AreEqual("/", await r1.GetContentAsync());
using var r2 = await runner.GetResponseAsync("/login/");
- Assert.AreEqual("/login/", await r2.GetContent());
+ Assert.AreEqual("/login/", await r2.GetContentAsync());
using var r3 = await runner.GetResponseAsync("/login");
- Assert.AreEqual("/login", await r3.GetContent());
+ Assert.AreEqual("/login", await r3.GetContentAsync());
}
[TestMethod]
@@ -315,13 +315,13 @@ public async Task TestQuery()
var runner = setup.Runner;
using var r2 = await runner.GetResponseAsync("/?one=two");
- Assert.AreEqual("one=two", await r2.GetContent());
+ Assert.AreEqual("one=two", await r2.GetContentAsync());
using var r3 = await runner.GetResponseAsync("/?one=two&three=four");
- Assert.AreEqual("one=two|three=four", await r3.GetContent());
+ Assert.AreEqual("one=two|three=four", await r3.GetContentAsync());
using var r1 = await runner.GetResponseAsync("/");
- Assert.AreEqual("", await r1.GetContent());
+ Assert.AreEqual("", await r1.GetContentAsync());
}
[TestMethod]
@@ -336,7 +336,7 @@ public async Task TestQuerySpecialChars()
var runner = setup.Runner;
using var r = await runner.GetResponseAsync("/?key=%20%3C+");
- Assert.AreEqual("key= <+", await r.GetContent());
+ Assert.AreEqual("key= <+", await r.GetContentAsync());
}
[TestMethod]
@@ -350,7 +350,7 @@ public async Task TestPathSpecialChars()
var runner = setup.Runner;
using var r = await runner.GetResponseAsync("/%3F%23%26%2F %20");
- Assert.AreEqual("/%3F%23%26%2F%20%20", await r.GetContent());
+ Assert.AreEqual("/%3F%23%26%2F%20%20", await r.GetContentAsync());
}
[TestMethod]
@@ -364,7 +364,7 @@ public async Task TestPathPreservesSpecialChars()
var runner = setup.Runner;
using var r = await runner.GetResponseAsync("/$@:");
- Assert.AreEqual("/$@:", await r.GetContent());
+ Assert.AreEqual("/$@:", await r.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/RobotsTests.cs b/Testing/Acceptance/Modules/RobotsTests.cs
index bd00ef85..b9ef1041 100644
--- a/Testing/Acceptance/Modules/RobotsTests.cs
+++ b/Testing/Acceptance/Modules/RobotsTests.cs
@@ -85,7 +85,7 @@ private static async Task GetRobots(TestHost runner)
{
using var response = await runner.GetResponseAsync("/" + BotInstructions.FILE_NAME);
- return (await response.GetContent()).Replace($":{runner.Port}", string.Empty);
+ return (await response.GetContentAsync()).Replace($":{runner.Port}", string.Empty);
}
private static IHandlerBuilder GetTest(RobotsProviderBuilder robots)
diff --git a/Testing/Acceptance/Modules/Security/CorsTests.cs b/Testing/Acceptance/Modules/Security/CorsTests.cs
index 81382414..c4765f03 100644
--- a/Testing/Acceptance/Modules/Security/CorsTests.cs
+++ b/Testing/Acceptance/Modules/Security/CorsTests.cs
@@ -50,7 +50,7 @@ public async Task TestPermissive()
Assert.AreEqual("86400", response.GetHeader("Access-Control-Max-Age"));
- Assert.AreEqual("Hello World", await response.GetContent());
+ Assert.AreEqual("Hello World", await response.GetContentAsync());
}
[TestMethod]
@@ -72,7 +72,7 @@ public async Task TestPermissiveWithoutDefaultAuthorizationHeader()
Assert.AreEqual("86400", response.GetHeader("Access-Control-Max-Age"));
- Assert.AreEqual("Hello World", await response.GetContent());
+ Assert.AreEqual("Hello World", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/ServerCaching/ServerCacheTests.cs b/Testing/Acceptance/Modules/ServerCaching/ServerCacheTests.cs
index cb66d77e..2d458b92 100644
--- a/Testing/Acceptance/Modules/ServerCaching/ServerCacheTests.cs
+++ b/Testing/Acceptance/Modules/ServerCaching/ServerCacheTests.cs
@@ -41,14 +41,14 @@ public async Task TestContentIsInvalidated()
using var first = await runner.GetResponseAsync();
await first.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("1", await first.GetContent());
+ Assert.AreEqual("1", await first.GetContentAsync());
FileUtil.WriteText(file, "12");
using var second = await runner.GetResponseAsync();
await second.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("12", await second.GetContent());
+ Assert.AreEqual("12", await second.GetContentAsync());
}
finally
{
@@ -71,14 +71,14 @@ public async Task TestContentNotInvalidated()
using var first = await runner.GetResponseAsync();
await first.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("1", await first.GetContent());
+ Assert.AreEqual("1", await first.GetContentAsync());
FileUtil.WriteText(file, "12");
using var second = await runner.GetResponseAsync();
await second.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("1", await second.GetContent());
+ Assert.AreEqual("1", await second.GetContentAsync());
}
finally
{
@@ -121,7 +121,7 @@ public async Task TestVariationRespected()
await uncompressedResponse.AssertStatusAsync(HttpStatusCode.OK);
AssertX.IsNullOrEmpty(uncompressedResponse.GetContentHeader("Content-Encoding"));
- Assert.AreEqual("This is some content!", await uncompressedResponse.GetContent());
+ Assert.AreEqual("This is some content!", await uncompressedResponse.GetContentAsync());
}
finally
{
@@ -162,7 +162,7 @@ public async Task TestHeadersPreserved()
Assert.AreEqual(now.ToString(), cached.Content.Headers.LastModified.GetValueOrDefault().UtcDateTime.ToString());
Assert.IsTrue(cached.GetContentHeader("Expires") != null);
- Assert.AreEqual("0123456789", await cached.GetContent());
+ Assert.AreEqual("0123456789", await cached.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/SinglePageTests.cs b/Testing/Acceptance/Modules/SinglePageTests.cs
index e38f7fd8..e9e36844 100644
--- a/Testing/Acceptance/Modules/SinglePageTests.cs
+++ b/Testing/Acceptance/Modules/SinglePageTests.cs
@@ -32,7 +32,7 @@ public async Task TestIndex()
await index.AssertStatusAsync(HttpStatusCode.OK);
Assert.AreEqual("text/html", index.GetContentHeader("Content-Type"));
- var content = await index.GetContent();
+ var content = await index.GetContentAsync();
Assert.AreEqual("This is the index!", content);
}
@@ -79,7 +79,7 @@ public async Task TestFile()
await index.AssertStatusAsync(HttpStatusCode.OK);
Assert.AreEqual("text/plain", index.GetContentHeader("Content-Type"));
- var content = await index.GetContent();
+ var content = await index.GetContentAsync();
Assert.AreEqual("This is some text file :)", content);
}
diff --git a/Testing/Acceptance/Modules/StaticWebsites/StaticWebsiteTests.cs b/Testing/Acceptance/Modules/StaticWebsites/StaticWebsiteTests.cs
index 1f25c163..018c09e4 100644
--- a/Testing/Acceptance/Modules/StaticWebsites/StaticWebsiteTests.cs
+++ b/Testing/Acceptance/Modules/StaticWebsites/StaticWebsiteTests.cs
@@ -25,10 +25,10 @@ public async Task TestWithIndex()
using var runner = TestHost.Run(StaticWebsite.From(tree));
using var indexResponse = await runner.GetResponseAsync();
- Assert.AreEqual("Index 1", await indexResponse.GetContent());
+ Assert.AreEqual("Index 1", await indexResponse.GetContentAsync());
using var subIndexResponse = await runner.GetResponseAsync("/sub/");
- Assert.AreEqual("Index 2", await subIndexResponse.GetContent());
+ Assert.AreEqual("Index 2", await subIndexResponse.GetContentAsync());
}
[TestMethod]
@@ -82,7 +82,7 @@ public async Task TestSitemapOverride()
using var runner = TestHost.Run(StaticWebsite.From(tree));
using var response = await runner.GetResponseAsync("/" + Sitemap.FILE_NAME);
- Assert.AreEqual("Custom Sitemap", await response.GetContent());
+ Assert.AreEqual("Custom Sitemap", await response.GetContentAsync());
}
[TestMethod]
@@ -113,7 +113,7 @@ public async Task TestRobotsOverride()
using var runner = TestHost.Run(StaticWebsite.From(tree));
using var response = await runner.GetResponseAsync("/" + BotInstructions.FILE_NAME);
- Assert.AreEqual("Custom Robots", await response.GetContent());
+ Assert.AreEqual("Custom Robots", await response.GetContentAsync());
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/VirtualHostsTests.cs b/Testing/Acceptance/Modules/VirtualHostsTests.cs
index 8cdd3b31..7baa3959 100644
--- a/Testing/Acceptance/Modules/VirtualHostsTests.cs
+++ b/Testing/Acceptance/Modules/VirtualHostsTests.cs
@@ -55,7 +55,7 @@ private static async Task RunTest(TestHost runner, string host, string? expected
using var response = await runner.GetResponseAsync(request);
- Assert.AreEqual(expected ?? host, await response.GetContent());
+ Assert.AreEqual(expected ?? host, await response.GetContentAsync());
}
}
diff --git a/Testing/Acceptance/Modules/WebserviceTests.cs b/Testing/Acceptance/Modules/WebserviceTests.cs
index 09ee98cb..665c8904 100644
--- a/Testing/Acceptance/Modules/WebserviceTests.cs
+++ b/Testing/Acceptance/Modules/WebserviceTests.cs
@@ -117,19 +117,19 @@ public async Task TestVoidReturn()
[TestMethod]
public async Task TestPrimitives()
{
- await WithResponse("primitive?input=42", async r => Assert.AreEqual("42", await r.GetContent()));
+ await WithResponse("primitive?input=42", async r => Assert.AreEqual("42", await r.GetContentAsync()));
}
[TestMethod]
public async Task TestEnums()
{
- await WithResponse("enum?input=One", async r => Assert.AreEqual("One", await r.GetContent()));
+ await WithResponse("enum?input=One", async r => Assert.AreEqual("One", await r.GetContentAsync()));
}
[TestMethod]
public async Task TestNullableSet()
{
- await WithResponse("nullable?input=1", async r => Assert.AreEqual("1", await r.GetContent()));
+ await WithResponse("nullable?input=1", async r => Assert.AreEqual("1", await r.GetContentAsync()));
}
[TestMethod]
@@ -143,13 +143,13 @@ public async Task TestGuid()
{
var id = Guid.NewGuid().ToString();
- await WithResponse($"guid?id={id}", async r => Assert.AreEqual(id, await r.GetContent()));
+ await WithResponse($"guid?id={id}", async r => Assert.AreEqual(id, await r.GetContentAsync()));
}
[TestMethod]
public async Task TestParam()
{
- await WithResponse("param/42", async r => Assert.AreEqual("42", await r.GetContent()));
+ await WithResponse("param/42", async r => Assert.AreEqual("42", await r.GetContentAsync()));
}
[TestMethod]
@@ -161,21 +161,21 @@ public async Task TestConversionFailure()
[TestMethod]
public async Task TestRegex()
{
- await WithResponse("regex/42", async r => Assert.AreEqual("42", await r.GetContent()));
+ await WithResponse("regex/42", async r => Assert.AreEqual("42", await r.GetContentAsync()));
}
[TestMethod]
public async Task TestEntityWithNulls()
{
var entity = "{\"id\":42}";
- await WithResponse("entity", HttpMethod.Post, entity, null, null, async r => Assert.AreEqual(entity, await r.GetContent()));
+ await WithResponse("entity", HttpMethod.Post, entity, null, null, async r => Assert.AreEqual(entity, await r.GetContentAsync()));
}
[TestMethod]
public async Task TestEntityWithNoNulls()
{
var entity = "{\"id\":42,\"nullable\":123.456}";
- await WithResponse("entity", HttpMethod.Post, entity, null, null, async r => Assert.AreEqual(entity, await r.GetContent()));
+ await WithResponse("entity", HttpMethod.Post, entity, null, null, async r => Assert.AreEqual(entity, await r.GetContentAsync()));
}
[TestMethod]
@@ -188,7 +188,7 @@ public async Task TestNotSupportedUpload()
public async Task TestUnsupportedDownloadEnforcesDefault()
{
var entity = "{\"id\":42,\"nullable\":123.456}";
- await WithResponse("entity", HttpMethod.Post, entity, null, "bla/blubb", async r => Assert.AreEqual(entity, await r.GetContent()));
+ await WithResponse("entity", HttpMethod.Post, entity, null, "bla/blubb", async r => Assert.AreEqual(entity, await r.GetContentAsync()));
}
[TestMethod]
@@ -206,19 +206,19 @@ public async Task TestNoMethod()
[TestMethod]
public async Task TestStream()
{
- await WithResponse("stream", HttpMethod.Put, "123456", null, null, async r => Assert.AreEqual("6", await r.GetContent()));
+ await WithResponse("stream", HttpMethod.Put, "123456", null, null, async r => Assert.AreEqual("6", await r.GetContentAsync()));
}
[TestMethod]
public async Task TestRequestResponse()
{
- await WithResponse("requestResponse", async r => Assert.AreEqual("Hello World", await r.GetContent()));
+ await WithResponse("requestResponse", async r => Assert.AreEqual("Hello World", await r.GetContentAsync()));
}
[TestMethod]
public async Task TestRouting()
{
- await WithResponse("request", async r => Assert.AreEqual("yes", await r.GetContent()));
+ await WithResponse("request", async r => Assert.AreEqual("yes", await r.GetContentAsync()));
}
[TestMethod]
diff --git a/Testing/Acceptance/Modules/Webservices/ResultTypeTests.cs b/Testing/Acceptance/Modules/Webservices/ResultTypeTests.cs
index 5a36b99e..abb52222 100644
--- a/Testing/Acceptance/Modules/Webservices/ResultTypeTests.cs
+++ b/Testing/Acceptance/Modules/Webservices/ResultTypeTests.cs
@@ -64,7 +64,7 @@ public async Task ControllerMayReturnGenericTask()
using var response = await runner.GetResponseAsync("/t/generic-task");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("Task result", await response.GetContent());
+ Assert.AreEqual("Task result", await response.GetContentAsync());
}
[TestMethod]
@@ -75,7 +75,7 @@ public async Task ControllerMayReturnGenericValueTask()
using var response = await runner.GetResponseAsync("/t/generic-value-task");
await response.AssertStatusAsync(HttpStatusCode.OK);
- Assert.AreEqual("ValueTask result", await response.GetContent());
+ Assert.AreEqual("ValueTask result", await response.GetContentAsync());
}
#endregion
diff --git a/Testing/Acceptance/Modules/WebsiteTests.cs b/Testing/Acceptance/Modules/WebsiteTests.cs
index 44615bfc..07702d45 100644
--- a/Testing/Acceptance/Modules/WebsiteTests.cs
+++ b/Testing/Acceptance/Modules/WebsiteTests.cs
@@ -68,7 +68,7 @@ public async Task TestErrorHandler()
await file.AssertStatusAsync(HttpStatusCode.NotFound);
Assert.AreEqual("text/html; charset=UTF-8", file.GetContentHeader("Content-Type"), StringComparer.InvariantCultureIgnoreCase);
- var content = await file.GetContent();
+ var content = await file.GetContentAsync();
AssertX.Contains("This is an error!", content);
@@ -118,10 +118,10 @@ public async Task TestCustomContent()
using var runner = TestHost.Run(website, development: false);
using var style = await runner.GetResponseAsync("/styles/bundle.css");
- AssertX.Contains("my", await style.GetContent());
+ AssertX.Contains("my", await style.GetContentAsync());
using var script = await runner.GetResponseAsync("/scripts/bundle.js");
- AssertX.Contains("my", await script.GetContent());
+ AssertX.Contains("my", await script.GetContentAsync());
}
[TestMethod]
@@ -236,7 +236,7 @@ public async Task TestWebsiteRouting()
using var response = await runner.GetResponseAsync("/sub/");
- var result = await response.GetContent();
+ var result = await response.GetContentAsync();
AssertX.Contains("script = ../scripts/s.js", result);
AssertX.Contains("style = ../styles/s.css", result);
@@ -281,7 +281,7 @@ public async Task TestAutoReload()
await script.AssertStatusAsync(HttpStatusCode.OK);
- AssertX.Contains("checkForModifications", await script.GetContent());
+ AssertX.Contains("checkForModifications", await script.GetContentAsync());
}
public static WebsiteBuilder GetWebsite(LayoutBuilder? content = null)
diff --git a/Testing/Acceptance/TestExtensions.cs b/Testing/Acceptance/TestExtensions.cs
index 602b8682..696cb21b 100644
--- a/Testing/Acceptance/TestExtensions.cs
+++ b/Testing/Acceptance/TestExtensions.cs
@@ -21,7 +21,7 @@ public static class TestExtensions
public static async Task> GetSitemap(this HttpResponseMessage response)
{
- var content = await response.GetContent();
+ var content = await response.GetContentAsync();
var sitemap = XDocument.Parse(content);
diff --git a/Testing/Testing/TestExtensions.cs b/Testing/Testing/TestExtensions.cs
index 7c6a2f0b..9844c72d 100644
--- a/Testing/Testing/TestExtensions.cs
+++ b/Testing/Testing/TestExtensions.cs
@@ -13,7 +13,7 @@ public static class TestExtensions
///
/// The response to read
/// The content of the HTTP response
- public static async ValueTask GetContent(this HttpResponseMessage response) => await response.Content.ReadAsStringAsync();
+ public static async ValueTask GetContentAsync(this HttpResponseMessage response) => await response.Content.ReadAsStringAsync();
public static string? GetHeader(this HttpResponseMessage response, string key)
{