spring-framework / org.springframework.web.servlet.function / RouterFunctionDsl / contentType

contentType

fun contentType(mediaType: MediaType, f: (ServerRequest) -> ServerResponse): Unit

Route to the given handler function if the given contentType predicate applies.

See Also

RouterFunctions.route

fun contentType(vararg mediaTypes: MediaType): RequestPredicate

Return a RequestPredicate that tests if the request's content type is included by any of the given media types.

Parameters

mediaTypes - the media types to match the request's content type against

Return
a predicate that tests the request's content type against the given media types