File tree 1 file changed +14
-4
lines changed
unirest/src/test/java/BehaviorTests
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 25
25
26
26
package BehaviorTests ;
27
27
28
- import kong .unirest .JsonNode ;
29
- import kong .unirest .MockCallback ;
30
- import kong .unirest .Unirest ;
31
- import kong .unirest .UnirestConfigException ;
28
+ import kong .unirest .*;
32
29
import kong .unirest .json .JSONArray ;
33
30
import kong .unirest .json .JSONObject ;
34
31
import org .junit .jupiter .api .Test ;
35
32
36
33
import java .nio .charset .StandardCharsets ;
37
34
38
35
import static kong .unirest .TestUtil .assertException ;
36
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
39
37
40
38
public class UniBodyPostingTest extends BddTest {
41
39
@ Test
@@ -166,4 +164,16 @@ public void cantPostObjectWithoutObjectMapper(){
166
164
UnirestConfigException .class ,
167
165
"No Object Mapper Configured. Please config one with Unirest.config().setObjectMapper" );
168
166
}
167
+
168
+ @ Test
169
+ void theRequestBodyIsAString () {
170
+ RequestBodyEntity request = Unirest .post (MockServer .POST )
171
+ .basicAuth ("foo" , "bar" )
172
+ .header ("Content-Type" , "application/json" )
173
+ .queryString ("foo" , "bar" )
174
+ .body ("{\" body\" : \" sample\" }" );
175
+
176
+ Object value = request .getBody ().get ().uniPart ().getValue ();
177
+ assertEquals ("{\" body\" : \" sample\" }" , value );
178
+ }
169
179
}
You can’t perform that action at this time.
0 commit comments