Skip to content

Commit

Permalink
stops Headers overrite the user defined ContentType (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebozduman authored Jan 7, 2025
1 parent f5e9e0a commit d77e881
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ internal static async Task<ObjectStat> PutObject_Tester(IMinioClient minio,
.WithStreamData(filestream)
.WithObjectSize(size)
.WithProgress(progress)
.WithContentType(contentType)
.WithHeaders(metaData);
.WithHeaders(metaData)
.WithContentType(contentType);
var statPutObj = await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);

var statObjectArgs = new StatObjectArgs()
Expand Down Expand Up @@ -3228,7 +3228,7 @@ internal static async Task PutObject_Test1(IMinioClient minio)
var startTime = DateTime.Now;
var bucketName = GetRandomName(15);
var objectName = GetRandomObjectName(10);
var contentType = "application/octet-stream";
var contentType = "image/png";
var size = 1 * MB;
var args = new Dictionary<string, string>
(StringComparer.Ordinal)
Expand Down
2 changes: 1 addition & 1 deletion Minio/DataModel/Args/PutObjectArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal override HttpRequestMessageBuilder BuildRequest(HttpRequestMessageBuild
if (string.IsNullOrWhiteSpace(ContentType)) ContentType = "application/octet-stream";
if (!Headers.ContainsKey("Content-Type")) Headers["Content-Type"] = ContentType;

requestMessageBuilder.AddOrUpdateHeaderParameter("Content-Type", Headers["Content-Type"]);
requestMessageBuilder.AddOrUpdateHeaderParameter("Content-Type", ContentType);
if (!string.IsNullOrWhiteSpace(UploadId) && PartNumber > 0)
{
requestMessageBuilder.AddQueryParameter("uploadId", $"{UploadId}");
Expand Down

0 comments on commit d77e881

Please sign in to comment.