
Version.pudu
Pudu20 lines798 B
1/** @Domain.Version.Module — the protocol version a request is sent with */2module PuduLangHttpClient.Domain.Version34import Std.Http as Http56/** @Domain.Version.Policy — how far the sent version may stray from the requested one */7export type Policy = OrLower | Exact | OrHigher891011export fn negotiate(requested: &Http.Version, policy: &Policy) -> Option[Http.Version] {12 match (*requested, *policy) {13 case (Http.Http10, OrHigher) => Some(Http.Http11)14 case (Http.Http10, _) => Some(Http.Http10)15 case (Http.Http11, _) => Some(Http.Http11)16 case (_, OrLower) => Some(Http.Http11)17 case _ => None18 }19}20