From a787538acfe575c62054586b36c29e442f316bf0 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 19 May 2023 18:10:20 +0800 Subject: [PATCH] =?UTF-8?q?${response.header.NAME}=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E4=B8=AD=E7=9A=84NAME=E5=8F=AF=E4=BB=A5=E6=98=AF=E9=9D=9E?= =?UTF-8?q?=E6=A0=87=E5=87=86=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 44c9b07..77e67cd 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -866,7 +866,23 @@ func (this *HTTPRequest) Format(source string) string { } switch suffix[:dotIndex] { case "header": - return this.writer.Header().Get(suffix[dotIndex+1:]) + var headers = this.writer.Header() + var headerKey = suffix[dotIndex+1:] + v, found := headers[headerKey] + if found { + if len(v) == 0 { + return "" + } + return v[0] + } + var canonicalHeaderKey = http.CanonicalHeaderKey(headerKey) + if canonicalHeaderKey != headerKey { + v = headers[canonicalHeaderKey] + if len(v) > 0 { + return v[0] + } + } + return "" } }