From 4493624bbc36fd89793a40a3e49bbec142619f08 Mon Sep 17 00:00:00 2001 From: Ryan Bergman Date: Sun, 18 Feb 2024 08:45:06 -0600 Subject: [PATCH] more tests --- .../src/test/java/BehaviorTests/HeaderAsserts.java | 4 ++++ .../java/BehaviorTests/MultiPartFormPostingTest.java | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/unirest-bdd-tests/src/test/java/BehaviorTests/HeaderAsserts.java b/unirest-bdd-tests/src/test/java/BehaviorTests/HeaderAsserts.java index b814c0d4..017f6d2e 100644 --- a/unirest-bdd-tests/src/test/java/BehaviorTests/HeaderAsserts.java +++ b/unirest-bdd-tests/src/test/java/BehaviorTests/HeaderAsserts.java @@ -167,6 +167,10 @@ public HeaderValue assertParam(String name, String value) { public String rawValue() { return rawValue; } + + public void assertRawValue(String value) { + assertThat(rawValue).isEqualTo(value); + } } } diff --git a/unirest-bdd-tests/src/test/java/BehaviorTests/MultiPartFormPostingTest.java b/unirest-bdd-tests/src/test/java/BehaviorTests/MultiPartFormPostingTest.java index cad9956e..645569c3 100644 --- a/unirest-bdd-tests/src/test/java/BehaviorTests/MultiPartFormPostingTest.java +++ b/unirest-bdd-tests/src/test/java/BehaviorTests/MultiPartFormPostingTest.java @@ -429,11 +429,14 @@ void mediaTypesForParts() { .field("content", rezInput("/spidey.pdf"), APPLICATION_PDF, "spiderman") .field("metadata", "{\"foo\": 1}", APPLICATION_JSON) .asObject(RequestCapture.class) - .ifSuccess(e -> System.out.println(e.getRequestSummary().asString())) .getBody() - .assertHeader("Content-Type", h -> - h.assertMainValue("multipart/form-data") - .assertHasParam("boundary")) + .assertHeader("Content-Type", h -> { + h.assertMainValue("multipart/form-data"); + h.assertHasParam("boundary"); + h.assertParam("charset", "UTF-8"); + // Lets create a way to tell unirest what the boundary should be so we can test it easier. + //h.assertRawValue("multipart/form-data; boundary=4ebf68bc-70f8-462b-b3a5-48dadb236af3;charset=UTF-8"); + }) .assertBodyPart("content", p -> { p.assertFileName("spiderman"); p.assertContentType("application/pdf");