Tests: added js headers tests when value is absent.
diff --git a/js_headers.t b/js_headers.t index 844e76b..3ad75ef 100644 --- a/js_headers.t +++ b/js_headers.t
@@ -142,6 +142,15 @@ } function content_length(r) { + if (njs.version_number >= 0x000705) { + var clength = r.headersOut['Content-Length']; + if (clength !== undefined) { + r.return(500, `Content-Length "\${clength}" is not empty`); + return; + } + } + + delete r.headersOut['Content-Length']; r.headersOut['Content-Length'] = ''; r.headersOut['Content-Length'] = 3; delete r.headersOut['Content-Length']; @@ -167,6 +176,15 @@ } function content_type(r) { + if (njs.version_number >= 0x000705) { + var ctype = r.headersOut['Content-Type']; + if (ctype !== undefined) { + r.return(500, `Content-Type "\${ctype}" is not empty`); + return; + } + } + + delete r.headersOut['Content-Type']; r.headersOut['Content-Type'] = 'text/xml'; r.headersOut['Content-Type'] = ''; r.headersOut['Content-Type'] = 'text/xml; charset='; @@ -185,6 +203,15 @@ } function content_encoding(r) { + if (njs.version_number >= 0x000705) { + var ce = r.headersOut['Content-Encoding']; + if (ce !== undefined) { + r.return(500, `Content-Encoding "\${ce}" is not empty`); + return; + } + } + + delete r.headersOut['Content-Encoding']; r.headersOut['Content-Encoding'] = ''; r.headersOut['Content-Encoding'] = 'test'; delete r.headersOut['Content-Encoding'];