Mercurial > hg > nginx-tests
changeset 1773:3f9b25f36e19
Tests: added js headers tests when value is absent.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Tue, 07 Jun 2022 21:28:14 -0700 |
parents | 4f238efded81 |
children | 5a625ce0de34 |
files | js_headers.t |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/js_headers.t Fri Jun 03 18:24:51 2022 +0400 +++ b/js_headers.t Tue Jun 07 21:28:14 2022 -0700 @@ -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'];