Skip to content

Commit 39a2cc8

Browse files
Merge pull request #987 from microsoft/mk/fix-multipart-formdata-issue
Cater for file content transferred with base64 encoding
2 parents fb6ea09 + 6d7f735 commit 39a2cc8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Microsoft.OpenApi/Models/OpenApiOperation.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,11 @@ public void SerializeAsV2(IOpenApiWriter writer)
253253
{
254254
foreach (var property in RequestBody.Content.First().Value.Schema.Properties)
255255
{
256-
var paramName = property.Key;
257256
var paramSchema = property.Value;
258-
if (paramSchema.Type == "string" && paramSchema.Format == "binary") {
257+
if ("string".Equals(paramSchema.Type, StringComparison.OrdinalIgnoreCase)
258+
&& ("binary".Equals(paramSchema.Format, StringComparison.OrdinalIgnoreCase)
259+
|| "base64".Equals(paramSchema.Format, StringComparison.OrdinalIgnoreCase)))
260+
{
259261
paramSchema.Type = "file";
260262
paramSchema.Format = null;
261263
}

0 commit comments

Comments
 (0)