dream/servers/mist/request

Request conversion from Mist to Dream format

This module provides functions to convert Mist HTTP requests to Dream request format, including method, header, and cookie conversion.

This is an internal module used by the Dream server implementation. Most applications won’t need to use this directly.

Values

pub fn convert_metadata(
  mist_req: request.Request(mist.Connection),
) -> #(request.Request, String)

Convert Mist request metadata to Dream request format

Converts a Mist HTTP request (headers, method, path, etc.) to Dream’s unified request format, but leaves the body empty. The body handling is deferred until after route matching to support streaming.

Parameters

  • mist_req: The original Mist request with Connection

Returns

A tuple of #(Dream Request, request_id) where:

  • Dream Request contains all HTTP metadata (empty body)
  • request_id is a unique identifier for this request
pub fn generate_request_id() -> String

Generate a simple request ID

Creates a request ID using the current process ID. This provides a unique identifier for each request that can be used for logging, tracing, and debugging.

In production applications, you may want to use UUID or a more sophisticated ID generation strategy.

Example

let request_id = generate_request_id()
// Returns something like: "#PID<0.123.0>"
Search Document