Commit 8667334bfe3c16f8486cf9b664f9f066a91ba331
1 parent
825d93bf
add function to get http header value with default value
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
web/CXM_common.anubis
| ... | ... | @@ -47,6 +47,20 @@ public define Maybe(String) |
| 47 | 47 | } |
| 48 | 48 | . |
| 49 | 49 | |
| 50 | +public define String | |
| 51 | + http_header_value | |
| 52 | + ( | |
| 53 | + List(HTTP_header) l, | |
| 54 | + String name, | |
| 55 | + String default | |
| 56 | + )= | |
| 57 | + if http_header_value(l, name) is | |
| 58 | + { | |
| 59 | + failure then default, | |
| 60 | + success(result) then result | |
| 61 | + } | |
| 62 | +. | |
| 63 | + | |
| 50 | 64 | public define List(String) |
| 51 | 65 | to_List_String |
| 52 | 66 | ( | ... | ... |