Class MockResponse

java.lang.Object
cloud.opencode.base.test.http.MockResponse

public final class MockResponse extends Object
Mock HTTP Response — a response to be returned by TestHttpServer for a matched route. 模拟 HTTP 响应 — TestHttpServer 为匹配路由返回的响应。

Features | 主要功能:

  • Immutable HTTP response definition - 不可变HTTP响应定义
  • Builder-style response construction - 构建器风格的响应构造

Usage Examples | 使用示例:

MockResponse response = MockResponse.ok("{\"status\": \"ok\"}")
    .withHeader("Content-Type", "application/json");

Security | 安全性:

  • Thread-safe: No - 线程安全: 否
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also: