A batteries included HTTP/1.1 client in OCaml

fixes

+33 -35
+17 -20
lib/signature.ml
··· 409 409 (* Context *) 410 410 (* ========================================================================= *) 411 411 412 - module Context = struct 413 - (** Request context for signature computation. *) 414 - type request_ctx = { 415 - method_ : Method.t; (** The HTTP method *) 416 - uri : Uri.t; (** The request URI *) 417 - headers : Headers.t; (** The request headers *) 418 - } 412 + type request_ctx = { 413 + method_ : Method.t; 414 + uri : Uri.t; 415 + headers : Headers.t; 416 + } 419 417 420 - (** Response context for signature computation. *) 421 - type response_ctx = { 422 - status : int; (** The HTTP status code *) 423 - headers : Headers.t; (** The response headers *) 424 - request : request_ctx option; (** The original request, if available *) 425 - } 418 + type response_ctx = { 419 + status : int; 420 + headers : Headers.t; 421 + request : request_ctx option; 422 + } 426 423 427 - (** Message context (request or response). *) 424 + module Context = struct 428 425 type t = [ 429 - | `Request of request_ctx (** A request context *) 430 - | `Response of response_ctx (** A response context *) 426 + | `Request of request_ctx 427 + | `Response of response_ctx 431 428 ] 432 429 433 430 let request ~method_ ~uri ~headers : t = ··· 517 514 518 515 let resolve_component (ctx : Context.t) (component : Component.t) = 519 516 let get_headers : Context.t -> Headers.t = function 520 - | `Request r -> r.Context.headers 521 - | `Response r -> r.Context.headers 517 + | `Request r -> r.headers 518 + | `Response r -> r.headers 522 519 in 523 520 let get_request_headers : Context.t -> Headers.t option = function 524 - | `Request r -> Some r.Context.headers 525 - | `Response (r : Context.response_ctx) -> Option.map (fun (req : Context.request_ctx) -> req.headers) r.request 521 + | `Request r -> Some r.headers 522 + | `Response (r : response_ctx) -> Option.map (fun (req : request_ctx) -> req.headers) r.request 526 523 in 527 524 match component with 528 525 | `Derived (d, params) ->
+16 -15
lib/signature.mli
··· 273 273 274 274 (** {1 Signing Context} *) 275 275 276 - module Context : sig 277 - (** Context for resolving message components. *) 276 + type request_ctx = { 277 + method_ : Method.t; 278 + uri : Uri.t; 279 + headers : Headers.t; 280 + } 281 + (** Request context for signature computation. 282 + Contains the HTTP method, request URI, and request headers. *) 278 283 279 - type request_ctx = { 280 - method_ : Method.t; (** The HTTP method *) 281 - uri : Uri.t; (** The request URI *) 282 - headers : Headers.t; (** The request headers *) 283 - } 284 - (** Request context for signature computation. *) 284 + type response_ctx = { 285 + status : int; 286 + headers : Headers.t; 287 + request : request_ctx option; 288 + } 289 + (** Response context for signature computation. 290 + Contains the HTTP status code, response headers, and optionally the original request. *) 285 291 286 - type response_ctx = { 287 - status : int; (** The HTTP status code *) 288 - headers : Headers.t; (** The response headers *) 289 - request : request_ctx option; (** The original request, if available *) 290 - } 291 - (** Response context for signature computation. *) 292 - 292 + (** Context for resolving message components. *) 293 + module Context : sig 293 294 type t = [ 294 295 | `Request of request_ctx 295 296 | `Response of response_ctx