Package org.mockserver.fixture
Class SseAwareExpectationConverter
- java.lang.Object
-
- org.mockserver.fixture.SseAwareExpectationConverter
-
public class SseAwareExpectationConverter extends Object
Converts a recordedExpectation(from aFORWARDED_REQUESTlog entry) into an SSE-aware replay expectation when the forwarded response was a streaming response.Detection is based on:
- The
x-mockserver-streamedheader being present (set by the streaming relay) - The
Content-Typeheader containingtext/event-stream
When a streaming response is detected and the capture was not truncated, the response body is parsed into
SseEventobjects and the expectation's response action is replaced with anHttpSseResponse.When the capture was truncated (
x-mockserver-stream-truncatedheader present), the expectation falls back to a static response with a warning header, since the SSE body is incomplete and cannot produce a correct replay.Non-streaming expectations are returned unchanged.
- The
-
-
Constructor Summary
Constructors Constructor Description SseAwareExpectationConverter()SseAwareExpectationConverter(long interEventDelayMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expectation[]convert(Expectation[] expectations)Convert an array of expectations, making streaming responses SSE-aware.
-
-
-
Method Detail
-
convert
public Expectation[] convert(Expectation[] expectations)
Convert an array of expectations, making streaming responses SSE-aware.- Parameters:
expectations- the recorded expectations- Returns:
- expectations with SSE responses where applicable
-
-