You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$"\n\n\n{_testData}",// Intentionally add a few blank lines before the data. These blank lines should be ignored by the parser when attempting to detect the boundary marker
24
+
newList<ParameterPart>{
25
+
newParameterPart("text","textdata"),
26
+
},
27
+
newList<FilePart>()
28
+
);
29
+
30
+
publicBlankLinesBeforeFirstBoundary()
31
+
{
32
+
foreach(varfilePartin_testCase.ExpectedFileData)
33
+
{
34
+
filePart.Data.Position=0;
35
+
}
36
+
}
37
+
38
+
/// <summary>
39
+
/// Tests for correct detection of the boundary in the input stream.
// Presumably the boundary is --|||||||||||||| where -- is the stuff added on to
256
261
// the front as per the protocol and ||||||||||||| is the part we care about.
257
-
varline=reader.ReadLine();
262
+
263
+
// The following loop ignores blank lines that may be present before the first line of the form.
264
+
// It's highly unusual to find blank lines at the start of the data but it's a possible scenario described in GH-116.
265
+
// Please note that we intentionally do NOT check for "string.IsNullOrEmpty(line)" because NULL does
266
+
// not indicate a blank line. It indicates that we have reached the end of the stream.
267
+
varline=string.Empty;
268
+
while(line==string.Empty)
269
+
{
270
+
line=reader.ReadLine();
271
+
}
258
272
259
273
// The line must not be empty and must starts with "--".
260
274
if(string.IsNullOrEmpty(line))thrownewMultipartParseException("Unable to determine boundary: either the stream is empty or we reached the end of the stream");
// The line must not be empty and must starts with "--".
302
330
if(string.IsNullOrEmpty(line))thrownewMultipartParseException("Unable to determine boundary: either the stream is empty or we reached the end of the stream");
0 commit comments