spring-framework / org.springframework.test.web.client.response / MockRestResponseCreators / withSuccess

withSuccess

open static fun withSuccess(): DefaultResponseCreator

ResponseCreator for a 200 response (OK).

open static fun withSuccess(body: String, @Nullable contentType: MediaType): DefaultResponseCreator

ResponseCreator for a 200 response (OK) with String body.

Parameters

body - the response body, a "UTF-8" string

contentType - the type of the content (may be null)

open static fun withSuccess(body: ByteArray, @Nullable contentType: MediaType): DefaultResponseCreator

ResponseCreator for a 200 response (OK) with byte[] body.

Parameters

body - the response body

contentType - the type of the content (may be null)

open static fun withSuccess(body: Resource, @Nullable contentType: MediaType): DefaultResponseCreator

ResponseCreator for a 200 response (OK) content with Resource-based body.

Parameters

body - the response body

contentType - the type of the content (may be null)