File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed
tests/FeatBit.ServerSdk.Tests Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ internal partial class DefaultEventSender : IEventSender
18
18
private static readonly TimeSpan DefaultTimeout = DefaultConnectTimeout + DefaultReadTimeout ;
19
19
20
20
private readonly Uri _eventUri ;
21
- private const string EventPath = "/ api/public/insight/track" ;
21
+ private const string EventPath = "api/public/insight/track" ;
22
22
private readonly int _maxAttempts ;
23
23
private readonly TimeSpan _retryInterval ;
24
24
Original file line number Diff line number Diff line change @@ -116,13 +116,8 @@ private WebSocketTransport DefaultWebSocketTransportFactory()
116
116
private static Uri DefaultWebSocketUriResolver ( FbOptions options )
117
117
{
118
118
var token = ConnectionToken . New ( options . EnvSecret ) ;
119
- var webSocketUri = new UriBuilder ( options . StreamingUri )
120
- {
121
- Path = "streaming" ,
122
- Query = $ "type=server&token={ token } "
123
- } . Uri ;
124
-
125
- return webSocketUri ;
119
+ var websocketUri = new Uri ( options . StreamingUri , $ "streaming?type=server&token={ token } ") ;
120
+ return websocketUri ;
126
121
}
127
122
128
123
private async Task ReceiveLoop ( )
Original file line number Diff line number Diff line change
1
+ namespace FeatBit . Sdk . Server ;
2
+
3
+ public class UriTests
4
+ {
5
+ // According to the documentation: https://learn.microsoft.com/en-us/dotnet/api/system.uri.-ctor?view=net-6.0#system-uri-ctor(system-uri-system-string)
6
+ // if the relative part of baseUri is to be preserved in the constructed Uri,
7
+ // the baseUri has relative parts (like /api), then the relative part must be terminated with a slash, (like /api/)
8
+ [ Theory ]
9
+ [ InlineData ( "https://contoso.com/featbit/" , "relative" , "https://contoso.com/featbit/relative" ) ]
10
+ [ InlineData ( "https://contoso.com/featbit/" , "/relative" , "https://contoso.com/relative" ) ]
11
+ [ InlineData ( "https://contoso.com/featbit/" , "relative?type=server" , "https://contoso.com/featbit/relative?type=server" ) ]
12
+ [ InlineData ( "https://contoso.com" , "relative" , "https://contoso.com/relative" ) ]
13
+ [ InlineData ( "https://contoso.com" , "/relative" , "https://contoso.com/relative" ) ]
14
+ [ InlineData ( "https://contoso.com/" , "/relative" , "https://contoso.com/relative" ) ]
15
+ public void CreateUri ( string @base , string relative , string expected )
16
+ {
17
+ var baseUri = new Uri ( @base ) ;
18
+ var uri = new Uri ( baseUri , relative ) ;
19
+
20
+ Assert . Equal ( expected , uri . ToString ( ) ) ;
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments