MockResponse

@Serializable
data class MockResponse(val statusCode: Int, val mediaType: String, val exampleName: String, val displayName: String, val content: String, val contentType: String = "application/json", val headers: Map<String, String> = emptyMap(), val isSynthesized: Boolean = false)

A loaded mock response variant, sourced from an OpenAPI response example declared in the spec (responses.<code>.content.<mediaType>.examples.<name>, see com.worldline.devview.networkmock.core.openapi.ExampleObject).

The identity of a response variant is the pair (statusCode, exampleName), not a file name — the file path (externalValue) is an implementation detail a spec author is free to move without changing which variant a user has selected. See OperationMockState.Mock.

See also

Constructors

Link copied to clipboard
constructor(statusCode: Int, mediaType: String, exampleName: String, displayName: String, content: String, contentType: String = "application/json", headers: Map<String, String> = emptyMap(), isSynthesized: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The raw response body, read from an example file or schema-synthesized. Empty for a bodyless response.

Link copied to clipboard

The concrete HTTP Content-Type header value emitted for this response. OpenAPI media ranges (such as wildcard types) are resolved to a concrete type compatible with content (application/json, text/plain, or application/octet-stream). Explicit types pass through unchanged, and empty bodies remain empty so no media-type-derived header is sent. Defaults to "application/json".

Link copied to clipboard

Human-readable name for UI display (e.g. "Success (200)", "Not Found - Detailed (404)")

Link copied to clipboard

The OpenAPI example name (e.g. "default", "detailed", "empty"). By convention, the primary/original response for a status code is named "default".

Link copied to clipboard

Response headers declared on responses.<code>.headers in the spec (name to literal example value). Does not include Content-Type, which is carried separately by contentType. Empty if the spec declares none.

Link copied to clipboard

Whether content was generated from a declared schema (see com.worldline.devview.networkmock.core.openapi.SchemaSynthesizer) rather than authored by the spec as an examples.<name>.externalValue file. false for every response variant sourced the normal way — this only ever flips to true for a status code that declared a schema but no examples of its own.

Link copied to clipboard
Link copied to clipboard

The HTTP status code this variant responds with