diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java index 54f59a6..6b19357 100644 --- a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java +++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original Egan. + * Copyright 2017-2023 the original Egan. * email egzosn@gmail.com * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,19 +59,34 @@ public class NoticeParams { this.headers = headers; } + private T getValueMatchingKey(Map values, String key) { + T value = values.get(key); + if (null != value) { + return value; + } + + for (Map.Entry entry : values.entrySet()) { + if (entry.getKey().equalsIgnoreCase(key)) { + return entry.getValue(); + } + } + return null; + } + + public String getHeader(String name) { - List value = this.headers.get(name); + List value = getValueMatchingKey(headers, name); return (null == value || value.isEmpty()) ? null : value.get(0); } public Enumeration getHeaders(String name) { - List value = this.headers.get(name); + List value = getValueMatchingKey(headers, name); return (Collections.enumeration(value != null ? value : Collections.emptySet())); } public Enumeration getHeaderNames() { - if (null == headers){ - return Collections.enumeration(Collections.emptySet()); + if (null == headers) { + return Collections.enumeration(Collections.emptySet()); } return Collections.enumeration(this.headers.keySet()); }