From fdb23012c4e1d9e6bfc375c318ece976896ef84c Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sat, 7 Oct 2023 21:00:09 +0800 Subject: [PATCH] njs: change responseBody to responseText Because of the deprecation of responseBody Signed-off-by: Miao Wang --- static/njs/fancy_index.njs | 2 +- static/njs/legacy_index.njs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/static/njs/fancy_index.njs b/static/njs/fancy_index.njs index 17cc091..3b06615 100644 --- a/static/njs/fancy_index.njs +++ b/static/njs/fancy_index.njs @@ -9,7 +9,7 @@ function fancyIndexRender(r, templateUrl){ if(rTmpl.status != 200){ return r.return(rTmpl.status); } - var tmpl = rTmpl.responseBody; + var tmpl = rTmpl.responseText; var result = Mark.up(tmpl, { url: r.variables.request_uri.replace(/\/+/g, '/').replace(/\?.*$/, ''), open: '{{', diff --git a/static/njs/legacy_index.njs b/static/njs/legacy_index.njs index 681f698..396ced3 100644 --- a/static/njs/legacy_index.njs +++ b/static/njs/legacy_index.njs @@ -24,7 +24,7 @@ function legacyIndexRender(r){ if(rTmpl.status != 200){ return r.return(rTmpl.status); } - var tmpl = rTmpl.responseBody; + var tmpl = rTmpl.responseText; r.subrequest('/static/njs/options.json', { args: '', @@ -36,7 +36,7 @@ function legacyIndexRender(r){ } var global_options; try{ - global_options = JSON.parse(rOpt.responseBody); + global_options = JSON.parse(rOpt.responseText); }catch(e){ return r.return(500); } @@ -58,7 +58,7 @@ function legacyIndexRender(r){ var mirs = unlisted; if(rMirs.status == 200){ try{ - mirs = mirs.concat(JSON.parse(rMirs.responseBody)); + mirs = mirs.concat(JSON.parse(rMirs.responseText)); }catch(e){ } }