use of io.restassured.internal.mapping.ObjectMapperSerializationContextImpl in project rest-assured by rest-assured.
the class MockMvcRequestSpecificationImpl method body.
public MockMvcRequestSpecification body(Object object, ObjectMapper mapper) {
notNull(object, "object");
notNull(mapper, "Object mapper");
String requestContentType = getRequestContentType();
ObjectMapperSerializationContextImpl ctx = new ObjectMapperSerializationContextImpl();
ctx.setObject(object);
ctx.setCharset(findEncoderCharsetOrReturnDefault(requestContentType));
ctx.setContentType(requestContentType);
this.requestBody = mapper.serialize(ctx);
return this;
}
use of io.restassured.internal.mapping.ObjectMapperSerializationContextImpl in project rest-assured by rest-assured.
the class MultiPartSpecBuilder method applyContentToSpec.
private void applyContentToSpec(MultiPartSpecificationImpl spec) {
final Object actualContent;
if (explicitObjectMapper != null) {
ObjectMapperSerializationContextImpl ctx = new ObjectMapperSerializationContextImpl();
ctx.setObject(content);
ctx.setContentType(mimeType);
actualContent = explicitObjectMapper.serialize(ctx);
} else if (explicitObjectMapperType != null) {
actualContent = ObjectMapping.serialize(content, mimeType, null, explicitObjectMapperType, new ObjectMapperConfig(), new EncoderConfig());
} else {
actualContent = content;
}
spec.setContent(actualContent);
}
Aggregations