-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kestrel HttpClient Http2 interop tests #4763
- Loading branch information
Showing
5 changed files
with
364 additions
and
13 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/Servers/Kestrel/shared/test/TransportTestHelpers/IHostPortExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.AspNetCore.Hosting.Server; | ||
using Microsoft.AspNetCore.Hosting.Server.Features; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace Microsoft.AspNetCore.Hosting | ||
{ | ||
public static class IHostPortExtensions | ||
{ | ||
public static int GetPort(this IHost host) | ||
{ | ||
return host.GetPorts().First(); | ||
} | ||
|
||
public static IEnumerable<int> GetPorts(this IHost host) | ||
{ | ||
return host.GetUris() | ||
.Select(u => u.Port); | ||
} | ||
|
||
public static IEnumerable<Uri> GetUris(this IHost host) | ||
{ | ||
return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses | ||
.Select(a => new Uri(a)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.