mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-21 02:58:06 +08:00
fix(wxapi): 修复潜在的内存泄漏问题
This commit is contained in:
@@ -357,8 +357,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
var httpContent = new MultipartFormDataContent(boundary);
|
||||
var fileContent = new ByteArrayContent(request.FileBytes ?? new byte[0]);
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
using var fileContent = new ByteArrayContent(request.FileBytes ?? new byte[0]);
|
||||
httpContent.Add(fileContent, "\"pdf\"", "\"invoice.pdf\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/pdf");
|
||||
|
@@ -45,8 +45,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("width", request.Width);
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
var httpContent = new MultipartFormDataContent(boundary);
|
||||
var fileContent = new ByteArrayContent(request.ImageFileBytes ?? new byte[0]);
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
using var fileContent = new ByteArrayContent(request.ImageFileBytes ?? new byte[0]);
|
||||
httpContent.Add(fileContent, "\"media\"", "\"image.png\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
|
||||
|
@@ -31,8 +31,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
var httpContent = new MultipartFormDataContent(boundary);
|
||||
var fileContent = new ByteArrayContent(request.ImageFileBytes ?? new byte[0]);
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
using var fileContent = new ByteArrayContent(request.ImageFileBytes ?? new byte[0]);
|
||||
httpContent.Add(fileContent, "\"media\"", "\"image.png\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
|
||||
|
Reference in New Issue
Block a user