dream_mock_server/controllers/stream_controller

stream_controller.gleam - Mock streaming endpoints

Provides various streaming endpoints for testing Dream’s HTTP client. Each endpoint demonstrates different streaming behaviors and patterns.

Values

pub fn index(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Index action - displays available endpoints (streaming and non-streaming)

pub fn stream_binary(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Binary streaming - Raw binary data

Demonstrates non-text streaming.

pub fn stream_burst(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Burst streaming - Random burst pattern with 5-10 chunks

Demonstrates variable chunk count and timing for testing robustness.

pub fn stream_error(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Error streaming - 3 chunks then fails

Demonstrates error handling mid-stream. Note: This returns a 500 status but still sends some chunks first.

pub fn stream_fast(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Fast streaming - 10 chunks at 100ms intervals

Demonstrates fast streaming for testing quick response handling.

pub fn stream_huge(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Huge streaming - 100 chunks for memory/performance testing

Demonstrates large response streaming.

pub fn stream_json(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

JSON streaming - Stream of JSON objects

Demonstrates structured data streaming.

pub fn stream_slow(
  request: request.Request,
  context: context.EmptyContext,
  services: router.EmptyServices,
) -> response.Response

Slow streaming - 5 chunks at 2s intervals

Demonstrates slow streaming for testing timeout handling.

Search Document