package awskit

  1. Overview
  2. Docs

Module Body.RequestSource

Sourcetype descriptor = private {
  1. content_length : int64 option;
    (*

    Exact body size when known. S3 upload operations currently require a known content length.

    *)
  2. payload_hash : Payload_hash.t;
    (*

    Payload hash or UNSIGNED-PAYLOAD value used for signing.

    *)
  3. replayable : bool;
    (*

    Whether the body writer can be run again for a retry. Set this to false for one-shot streams.

    *)
}

Request body facts known before a runtime writes the body. Service packages use this to sign requests and decide whether retry is possible.

Sourceval descriptor : ?content_length:int64 -> payload_hash:Payload_hash.t -> replayable:bool -> unit -> (descriptor, Error.t) result

Build request body facts. Present content_length values must be non-negative.

Sourceval descriptor_exn : ?content_length:int64 -> payload_hash:Payload_hash.t -> replayable:bool -> unit -> descriptor

Like descriptor, but raises Error.Awskit_error carrying the structured validation error on validation failure.

Sourceval validate_descriptor : descriptor -> (unit, Error.t) result

Validate descriptor invariants such as non-negative lengths.

Sourceval raise_escaped_exn : exn -> 'a

Raise exn through the runtime request-body writer boundary.

Runtime adapters unwrap this marker and propagate the original exception. Request-body writers must still return Error error for ordinary body failures that should surface as Awskit.Error.kind.Body.

Sourceval escaped_exn : exn -> exn option

Return the original exception when an exception was raised with raise_escaped_exn.