diff --git a/Directory.Build.targets b/Directory.Build.targets index cc00330b206..eb2e9b5f23d 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -105,6 +105,7 @@ BaseOutDir; ReactNativeDir; ReactNativeWindowsDir; + RnwNewArch; FollyDir; YogaDir; WinVer; diff --git a/change/react-native-windows-14d8afe5-5c05-4205-aeec-11134992e9c2.json b/change/react-native-windows-14d8afe5-5c05-4205-aeec-11134992e9c2.json new file mode 100644 index 00000000000..c647fcb05d5 --- /dev/null +++ b/change/react-native-windows-14d8afe5-5c05-4205-aeec-11134992e9c2.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Add multipart/form-data test endpoint", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/vnext/TestWebSite/Microsoft/Office/OfficeJsTests.cs b/vnext/TestWebSite/Microsoft/Office/OfficeJsTests.cs index 917fc139f9c..6f26f9cafc3 100644 --- a/vnext/TestWebSite/Microsoft/Office/OfficeJsTests.cs +++ b/vnext/TestWebSite/Microsoft/Office/OfficeJsTests.cs @@ -1,4 +1,5 @@ using System.Text; +using System.Text.RegularExpressions; namespace Microsoft.Office.Test { @@ -13,5 +14,31 @@ public static async Task Issue4144(HttpContext context) var bytes = Encoding.UTF8.GetBytes("Check headers: [Access-Control-Allow-Origin]"); await response.Body.WriteAsync(bytes); } + + public static async Task Issue5869(HttpContext context) + { + var response = context.Response; + response.ContentType = "text/plain"; + response.StatusCode = 200; + + var request = context.Request; + + string? resBody; + if (Regex.IsMatch(request.ContentType!, @"multipart/form-data(;\s+.*)?")) + { + resBody = $"Multipart form data with {request.Form.Count} entries"; + } + else if (request.ContentType == "application/x-www-form-urlencoded") + { + resBody = $"URL-encoded form data with {request.Form.Count} entries"; + } + else + { + resBody = $"Unknown Content-Type [{request.ContentType}]"; + } + + var bytes = Encoding.UTF8.GetBytes(resBody); + await response.Body.WriteAsync(bytes); + } } } diff --git a/vnext/TestWebSite/Program.cs b/vnext/TestWebSite/Program.cs index ef80f6b735f..0fe4dd3aca7 100644 --- a/vnext/TestWebSite/Program.cs +++ b/vnext/TestWebSite/Program.cs @@ -85,6 +85,10 @@ async Task DefaultRequestDelegate(HttpContext context) Microsoft.Office.Test.OfficeJsTests.Issue4144) .RequireCors(originPolicyName); +app.MapPost( + "/officedev/office-js/issues/5869", + Microsoft.Office.Test.OfficeJsTests.Issue5869); + #endregion Request Mappings await app.RunAsync();