Minor forgotten dispose in tests

This commit is contained in:
nicolas.dorier
2024-11-07 10:47:02 +09:00
parent a129114603
commit bbba7551b7

View File

@@ -156,7 +156,7 @@ public partial class BTCPayServerClient
protected virtual async Task<T> UploadFileRequest<T>(string apiPath, string filePath, string mimeType, string formFieldName, HttpMethod method = null, CancellationToken token = default) protected virtual async Task<T> UploadFileRequest<T>(string apiPath, string filePath, string mimeType, string formFieldName, HttpMethod method = null, CancellationToken token = default)
{ {
using MultipartFormDataContent multipartContent = new(); using MultipartFormDataContent multipartContent = new();
var fileContent = new StreamContent(File.OpenRead(filePath)); using var fileContent = new StreamContent(File.OpenRead(filePath));
var fileName = Path.GetFileName(filePath); var fileName = Path.GetFileName(filePath);
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(mimeType); fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(mimeType);
multipartContent.Add(fileContent, formFieldName, fileName); multipartContent.Add(fileContent, formFieldName, fileName);