Skip to content

Commit

Permalink
Multipart postfix fix (#2233)
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <david.k.kral@oracle.com>
  • Loading branch information
Verdent authored Aug 6, 2020
1 parent 9db48af commit 96421c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ private Publisher<DataChunk> createBodyPartPublisher(final WriteableBodyPart bod
// Part body
bodyPart.content().init(context)),
// Part postfix
Single.just(DataChunk.create("\n".getBytes(StandardCharsets.UTF_8))));
Single.just(DataChunk.create("\r\n".getBytes(StandardCharsets.UTF_8))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@

import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Flow;
import java.util.concurrent.Flow.Subscriber;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.TimeUnit;
import java.util.stream.LongStream;

import io.helidon.common.http.MediaType;
import io.helidon.common.http.DataChunk;
import io.helidon.common.http.MediaType;
import io.helidon.common.reactive.Multi;
import io.helidon.media.common.ContentReaders;
import io.helidon.media.multipart.MultiPartDecoderTest.DataChunkSubscriber;
Expand Down Expand Up @@ -55,7 +58,7 @@ public void testEncodeOnePart() throws Exception {
assertThat(message, is(equalTo(
"--" + boundary + "\r\n"
+ "\r\n"
+ "part1\n"
+ "part1\r\n"
+ "--" + boundary + "--")));
}

Expand All @@ -73,7 +76,7 @@ public void testEncodeOnePartWithHeaders() throws Exception {
"--" + boundary + "\r\n"
+ "Content-Type:text/plain\r\n"
+ "\r\n"
+ "part1\n"
+ "part1\r\n"
+ "--" + boundary + "--")));
}

Expand All @@ -90,10 +93,10 @@ public void testEncodeTwoParts() throws Exception {
assertThat(message, is(equalTo(
"--" + boundary + "\r\n"
+ "\r\n"
+ "part1\n"
+ "part1\r\n"
+ "--" + boundary + "\r\n"
+ "\r\n"
+ "part2\n"
+ "part2\r\n"
+ "--" + boundary + "--")));
}

Expand Down

0 comments on commit 96421c7

Please sign in to comment.