spring-framework / org.springframework.web.reactive.function.server / CoRouterFunctionDsl / accept

accept

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

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

See Also

RouterFunctions.route

fun accept(vararg mediaType: MediaType): RequestPredicate

Return a RequestPredicate that tests if the request's accept } header is compatible with any of the given media types.

Parameters

mediaType - the media types to match the request's accept header against

Return
a predicate that tests the request's accept header against the given media types