Skip to content

Commit 51e62f5

Browse files
Initial commit
1 parent 2d606df commit 51e62f5

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

ReactWindows/ReactNative/Modules/Network/NetworkingModule.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,28 @@ public void sendRequest(
121121
}
122122
else if ((formData = data.Value<JArray>("formData")) != null)
123123
{
124-
// TODO: (#388) Add support for form data.
125-
throw new NotImplementedException("HTTP handling for FormData not yet implemented.");
124+
if (headerData.ContentType == null)
125+
{
126+
headerData.ContentType = "multipart/form-data";
127+
}
128+
129+
var formDataContent = new HttpMultipartFormDataContent();
130+
foreach (var content in formData)
131+
{
132+
var fieldName = content.Value<string>("fieldName");
133+
134+
var formDataHeaders = content.Value<JArray>("headers");
135+
136+
var stringContent = content.Value<string>("string");
137+
if (stringContent != null)
138+
{
139+
formDataContent.Add(new HttpStringContent(stringContent), fieldName);
140+
}
141+
}
142+
143+
request.Content = formDataContent;
144+
// TODO: Check for gzipped body content
145+
// TODO: Issue #383
126146
}
127147
}
128148

0 commit comments

Comments
 (0)