Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 5bee3c9

Browse files
committed
Fix TransportContext.GetChanelBinding in managed implementation
1 parent d3fd2bb commit 5bee3c9

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/System.Net.HttpListener/src/System/Net/Managed/HttpListenerRequest.Managed.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ private class Context : TransportContext
4545
{
4646
public override ChannelBinding GetChannelBinding(ChannelBindingKind kind)
4747
{
48-
throw new NotImplementedException();
48+
if (kind != ChannelBindingKind.Endpoint)
49+
{
50+
throw new NotSupportedException(SR.Format(SR.net_listener_invalid_cbt_type, kind.ToString()));
51+
}
52+
53+
return null;
4954
}
5055
}
5156

src/System.Net.HttpListener/tests/HttpListenerRequestTests.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,7 @@ await GetRequest("POST", null, null, (_, request) =>
316316
});
317317
}
318318

319-
[ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsNotWindowsImplementation))] // [ActiveIssue(20239, TestPlatforms.AnyUnix)]
320-
public async Task TransportContext_GetUnix_ThrowsNotImplementedException()
321-
{
322-
await GetRequest("POST", null, null, (_, request) =>
323-
{
324-
Assert.Throws<NotImplementedException>(() => request.TransportContext.GetChannelBinding(ChannelBindingKind.Endpoint));
325-
});
326-
}
327-
328-
[ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20239, TestPlatforms.AnyUnix)]
319+
[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
329320
public async Task TransportContext_GetChannelBinding_ReturnsExpected()
330321
{
331322
// This might not work on other devices:
@@ -337,8 +328,7 @@ await GetRequest("POST", null, null, (_, request) =>
337328
});
338329
}
339330

340-
[ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20239, TestPlatforms.AnyUnix)]
341-
[InlineData(ChannelBindingKind.Unique)]
331+
[ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]
342332
[InlineData(ChannelBindingKind.Unique)]
343333
public async Task TransportContext_GetChannelBindingInvalid_ThrowsNotSupportedException(ChannelBindingKind kind)
344334
{

0 commit comments

Comments
 (0)