Skip to content

WebServiceTarget - Change from legacy HttpWebRequest to HttpClient#19

Open
snakefoot wants to merge 4 commits intoNLog:masterfrom
snakefoot:HttpClient
Open

WebServiceTarget - Change from legacy HttpWebRequest to HttpClient#19
snakefoot wants to merge 4 commits intoNLog:masterfrom
snakefoot:HttpClient

Conversation

@snakefoot
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates WebServiceTarget from legacy HttpWebRequest-based sending to HttpClient, and updates the unit test to validate request payload generation via an injectable HttpClient.

Changes:

  • Replace async HttpWebRequest send/response flow with HttpClient.SendAsync and HttpRequestMessage construction.
  • Update UTF-8 BOM unit test to capture the last HttpRequestMessage and payload bytes via a custom HttpMessageHandler.
  • Add System.Net.Http reference for .NET Framework builds of the target project.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tests/NLog.Targets.WebService.Tests/WebServiceTargetTests.cs Updates the POST UTF-8 BOM test to validate request body bytes via an injected HttpClient handler.
src/NLog.Targets.WebService/WebServiceTarget.cs Core migration from HttpWebRequest to HttpClient, adds HttpRequestMessage creation and internal client injection for tests.
src/NLog.Targets.WebService/NLog.Targets.WebService.csproj Adds System.Net.Http reference for .NET Framework builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/NLog.Targets.WebService/WebServiceTarget.cs Outdated
Comment thread src/NLog.Targets.WebService/WebServiceTarget.cs
Comment thread src/NLog.Targets.WebService/WebServiceTarget.cs
Comment thread src/NLog.Targets.WebService/WebServiceTarget.cs
Comment thread src/NLog.Targets.WebService/WebServiceTarget.cs Outdated
snakefoot and others added 2 commits April 23, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants