extractRequestEntity

extractRequestEntity

Description

Extracts the RequestEntity from the RequestContext.

The directive returns a RequestEntity without unmarshalling the request. To extract domain entity, entity should be used.

Example

final Route route = extractRequestEntity(entity ->
  complete("Request entity content-type is " + entity.getContentType())
);

// tests:
testRoute(route).run(
  HttpRequest.POST("/abc")
    .withEntity(HttpEntities.create(ContentTypes.TEXT_PLAIN_UTF8, "req"))
).assertEntity("Request entity content-type is text/plain; charset=UTF-8");

Contents