# HG changeset patch # User Dmitry Volyntsev # Date 1654662494 25200 # Node ID 3f9b25f36e196bfe663f1c20aec1dd130356cec8 # Parent 4f238efded81e00c635c146df6ecb585fa0907ec Tests: added js headers tests when value is absent. diff --git a/js_headers.t b/js_headers.t --- a/js_headers.t +++ b/js_headers.t @@ -142,6 +142,15 @@ EOF } 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 @@ EOF } 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 @@ EOF } 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'];