File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
ReactWindows/ReactNative/Modules/Network Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -121,8 +121,28 @@ public void sendRequest(
121
121
}
122
122
else if ( ( formData = data . Value < JArray > ( "formData" ) ) != null )
123
123
{
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
126
146
}
127
147
}
128
148
You can’t perform that action at this time.
0 commit comments