001/* 002 * Copyright 2022-2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.soklet; 018 019import org.jspecify.annotations.NonNull; 020 021import javax.annotation.concurrent.ThreadSafe; 022import java.util.Map; 023import java.util.Optional; 024import java.util.List; 025 026/** 027 * Immutable response-head and bounded nonstreaming-body projection. 028 * 029 * @author <a href="https://www.revetkn.com">Mark Allen</a> 030 */ 031@ThreadSafe 032public interface McpSimulationResponse { 033 /** @return the HTTP status code, between 100 and 599 */ 034 @NonNull 035 Integer getStatusCode(); 036 037 /** 038 * Returns an immutable insertion-ordered header projection. Header names are 039 * coalesced case-insensitively under the first observed spelling, and values 040 * retain insertion order. Header-name lookups are also case-insensitive. 041 * 042 * @return immutable response headers 043 */ 044 @NonNull 045 Map<@NonNull String, @NonNull List<@NonNull String>> getHeaders(); 046 047 /** @return the captured response-body type */ 048 @NonNull 049 McpSimulationBodyType getBodyType(); 050 051 /** 052 * Returns a fresh copy for successfully captured EMPTY and JSON bodies. 053 * EMPTY returns a present zero-length array. SSE responses and JSON responses 054 * that exceed the byte bound return empty. 055 * 056 * @return a fresh body copy when the bounded body is available 057 */ 058 @NonNull 059 Optional<byte @NonNull []> getBody(); 060}