use of jakarta.ws.rs.core.Form in project resteasy by resteasy.
the class FormUrlEncodedCharsetTest method testFormUTF8.
/**
* @tpTestDetails Test for UTF8 charset.
* @tpSince RESTEasy 3.0.17
*/
@Test
public void testFormUTF8() throws UnsupportedEncodingException {
Form form = new Form();
form.param("name", alephBetGimel);
Entity<Form> entity = Entity.entity(form, testMediaType8);
Response response = target.request().post(entity);
String result = response.readEntity(String.class);
logger.info("result: " + result);
Assert.assertEquals("EAP is unable to encode UTF8 charset", result, alephBetGimel);
}
use of jakarta.ws.rs.core.Form in project resteasy by resteasy.
the class FormUrlEncodedCharsetTest method testFormDefault.
/**
* @tpTestDetails Test for default charset.
* @tpSince RESTEasy 3.0.17
*/
@Test
public void testFormDefault() throws UnsupportedEncodingException {
Form form = new Form();
form.param("name", alephBetGimel);
Entity<Form> entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE);
Response response = target.request().post(entity);
String result = response.readEntity(String.class);
logger.info("result: " + result);
Assert.assertEquals("EAP is unable to encode default charset", result, alephBetGimel);
}
use of jakarta.ws.rs.core.Form in project resteasy by resteasy.
the class FormUrlEncodedTest method testQueryParamIsNull.
/**
* @tpTestDetails Send form with a missing query parameter.
* @tpSince RESTEasy 3.0.20
*/
@Test
public void testQueryParamIsNull() {
Builder builder = client.target(generateURL("/simple")).request();
try {
Response response = builder.post(Entity.form(new Form("hello", "world")));
Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
Assert.assertEquals("hello=world", response.readEntity(String.class));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of jakarta.ws.rs.core.Form in project resteasy by resteasy.
the class ResteasyUseContainerFormParamsTest method testMap.
@Test
public void testMap() throws Exception {
Builder builder = client.target(generateURL("/map")).request();
Response response = builder.post(Entity.form(new Form("hello", "world").param("yo", "mama")));
Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
}
use of jakarta.ws.rs.core.Form in project resteasy by resteasy.
the class ResteasyUseContainerFormParamsTest method testForm.
@Test
public void testForm() throws Exception {
Builder builder = client.target(generateURL("/form")).request();
Response response = builder.post(Entity.form(new Form("hello", "world").param("yo", "mama")));
Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
}
Aggregations