Skip to content

Commit 6c906bd

Browse files
committed
small cleanup
1 parent 3c9dc75 commit 6c906bd

File tree

6 files changed

+20
-71
lines changed

6 files changed

+20
-71
lines changed

src/Servers/Kestrel/Core/src/CoreStrings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,4 +596,7 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l
596596
<data name="ServerShutdownDuringConnectionInitialization" xml:space="preserve">
597597
<value>Server shutdown started during connection initialization.</value>
598598
</data>
599+
<data name="StartAsyncBeforeGetMemory" xml:space="preserve">
600+
<value>Cannot call GetMemory() until response has started. Call HttpResponse.StartAsync() before calling GetMemory().</value>
601+
</data>
599602
</root>

src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,8 +1286,7 @@ private void ThrowIfResponseNotStarted()
12861286
{
12871287
if (!HasResponseStarted)
12881288
{
1289-
throw new InvalidOperationException("Cannot call GetMemory() until response has started. " +
1290-
"Call HttpResponse.StartAsync() before calling GetMemory().");
1289+
throw new InvalidOperationException(CoreStrings.StartAsyncBeforeGetMemory);
12911290
}
12921291
}
12931292

src/Servers/Kestrel/Core/src/Properties/CoreStrings.Designer.cs

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Servers/Kestrel/shared/test/HttpResponseWritingExtensions.cs

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public async Task IgnoreNullHeaderValues(string headerName, StringValues headerV
109109
{
110110
context.Response.Headers.Add(headerName, headerValue);
111111

112-
await context.Response.WriteResponseAsync("");
112+
await context.Response.WriteAsync("");
113113
});
114114
});
115115

@@ -153,7 +153,7 @@ public async Task WriteAfterConnectionCloseNoops(ListenOptions listenOptions)
153153
requestStarted.SetResult(null);
154154
await connectionClosed.Task.DefaultTimeout();
155155
httpContext.Response.ContentLength = 12;
156-
await httpContext.Response.WriteResponseAsync("hello, world");
156+
await httpContext.Response.WriteAsync("hello, world");
157157
appCompleted.TrySetResult(null);
158158
}
159159
catch (Exception ex)
@@ -209,7 +209,7 @@ public async Task ThrowsOnWriteWithRequestAbortedTokenAfterRequestIsAborted(List
209209

210210
try
211211
{
212-
await response.WriteResponseAsync(largeString, token: lifetime.RequestAborted);
212+
await response.WriteAsync(largeString, cancellationToken: lifetime.RequestAborted);
213213
}
214214
catch (Exception ex)
215215
{

src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
<Content Include="$(KestrelSharedSourceRoot)test\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
1313
</ItemGroup>
1414

15-
<ItemGroup>
16-
<Compile Remove="C:\Users\jukotali\code\aspnetcore\src\Servers\Kestrel\shared\test\HttpResponseWritingExtensions.cs" />
17-
</ItemGroup>
18-
1915
<ItemGroup>
2016
<Reference Include="Microsoft.AspNetCore.Http.Abstractions" />
2117
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />

0 commit comments

Comments
 (0)