Skip to content

Commit 217fd53

Browse files
committed
fix URL path detection to check path only, not full hostname
1 parent 2ac3e2f commit 217fd53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorRequest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ internal class EventCollectorRequest : HttpRequestMessage
2323
{
2424
internal EventCollectorRequest(string splunkHost, string jsonPayLoad, string uri = ConfigurationDefaults.DefaultEventCollectorPath)
2525
{
26-
var hostUrl = splunkHost.Contains(ConfigurationDefaults.DefaultCollectorPath)
26+
var baseUri = new Uri(splunkHost.TrimEnd('/'));
27+
var hostUrl = baseUri.AbsolutePath.Contains(ConfigurationDefaults.DefaultCollectorPath)
2728
? splunkHost
2829
: $"{splunkHost.TrimEnd('/')}/{uri.TrimStart('/').TrimEnd('/')}";
29-
30+
3031
RequestUri = new Uri(hostUrl);
3132
Content = new StringContent(jsonPayLoad, Encoding.UTF8, "application/json");
3233
Method = HttpMethod.Post;

0 commit comments

Comments
 (0)