use of com.github.mjeanroy.junit.servers.client.HttpRequestBody in project junit-servers by mjeanroy.
the class BaseHttpClientTest method testRequest_add_form_param_without_value.
@Test
void testRequest_add_form_param_without_value() {
final String name = "flag";
final String value = "";
final Map<String, String> parameters = singletonMap(name, value);
final HttpRequestBody body = formUrlEncodedBody(parameters);
final String expectedBody = encodeFormParam(name, value);
testRequestBody(expectedBody, rq -> rq.setBody(body));
}
use of com.github.mjeanroy.junit.servers.client.HttpRequestBody in project junit-servers by mjeanroy.
the class BaseHttpClientTest method testRequest_add_body_form.
@Test
void testRequest_add_body_form() {
final String n1 = "firstName";
final String v1 = "John";
final HttpParameter p1 = param(n1, v1);
final String n2 = "lastName";
final String v2 = "Doe";
final HttpParameter p2 = param(n2, v2);
final String expectedBody = encodeFormParam(n1, v1) + "&" + encodeFormParam(n2, v2);
final HttpRequestBody body = formUrlEncodedBody(p1, p2);
testRequestBody(expectedBody, rq -> rq.setBody(body));
}
Aggregations