From 8667334bfe3c16f8486cf9b664f9f066a91ba331 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 17 Aug 2019 10:43:48 +0900 Subject: [PATCH] add function to get http header value with default value --- web/CXM_common.anubis | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) diff --git a/web/CXM_common.anubis b/web/CXM_common.anubis index ed03f7c..3e4b173 100644 --- a/web/CXM_common.anubis +++ b/web/CXM_common.anubis @@ -47,6 +47,20 @@ public define Maybe(String) } . +public define String + http_header_value + ( + List(HTTP_header) l, + String name, + String default + )= + if http_header_value(l, name) is + { + failure then default, + success(result) then result + } +. + public define List(String) to_List_String ( -- libgit2 0.21.4