1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-18 05:50:06 +00:00

fix: setting server headers only if STREAM mode enabled to avoid 'Function is only valid for filerefs using the CACHE access method.' error when testing STPs from Studio. Also removing proc json as it cannot handle invalid characters.

This commit is contained in:
Allan Bowe
2021-05-01 16:27:41 +03:00
parent 328f8c260b
commit fdd566e8ce
3 changed files with 48 additions and 44 deletions

46
all.sas
View File

@@ -7675,8 +7675,16 @@ data _null_;
put '%else %if &action=OPEN %then %do; '; put '%else %if &action=OPEN %then %do; ';
put ' /* fix encoding */ '; put ' /* fix encoding */ ';
put ' OPTIONS NOBOMFILE; '; put ' OPTIONS NOBOMFILE; ';
put ' ';
put ' /** ';
put ' * check engine type to avoid the below err message: ';
put ' * > Function is only valid for filerefs using the CACHE access method. ';
put ' */ ';
put ' data _null_; '; put ' data _null_; ';
put ' rc = stpsrv_header(''Content-type'',"text/html; encoding=utf-8"); '; put ' set sashelp.vextfl(where=(fileref="_WEBOUT")); ';
put ' if xengine=''STREAM'' then do; ';
put ' rc=stpsrv_header(''Content-type'',"text/html; encoding=utf-8"); ';
put ' end; ';
put ' run; '; put ' run; ';
put ' '; put ' ';
put ' /* setup json */ '; put ' /* setup json */ ';
@@ -7690,16 +7698,9 @@ data _null_;
put '%end; '; put '%end; ';
put ' '; put ' ';
put '%else %if &action=ARR or &action=OBJ %then %do; '; put '%else %if &action=ARR or &action=OBJ %then %do; ';
put ' %if &sysver=9.4 %then %do; '; put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt '; put ' ,engine=DATASTEP,dbg=%str(&_debug) ';
put ' ,engine=PROCJSON,dbg=%str(&_debug) '; put ' ) ';
put ' ) ';
put ' %end; ';
put ' %else %do; ';
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
put ' ,engine=DATASTEP,dbg=%str(&_debug) ';
put ' ) ';
put ' %end; ';
put '%end; '; put '%end; ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
put ' %if %str(&_debug) ge 131 %then %do; '; put ' %if %str(&_debug) ge 131 %then %do; ';
@@ -11144,8 +11145,16 @@ run;
%else %if &action=OPEN %then %do; %else %if &action=OPEN %then %do;
/* fix encoding */ /* fix encoding */
OPTIONS NOBOMFILE; OPTIONS NOBOMFILE;
/**
* check engine type to avoid the below err message:
* > Function is only valid for filerefs using the CACHE access method.
*/
data _null_; data _null_;
rc = stpsrv_header('Content-type',"text/html; encoding=utf-8"); set sashelp.vextfl(where=(fileref="_WEBOUT"));
if xengine='STREAM' then do;
rc=stpsrv_header('Content-type',"text/html; encoding=utf-8");
end;
run; run;
/* setup json */ /* setup json */
@@ -11159,16 +11168,9 @@ run;
%end; %end;
%else %if &action=ARR or &action=OBJ %then %do; %else %if &action=ARR or &action=OBJ %then %do;
%if &sysver=9.4 %then %do; %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ,engine=DATASTEP,dbg=%str(&_debug)
,engine=PROCJSON,dbg=%str(&_debug) )
)
%end;
%else %do;
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
,engine=DATASTEP,dbg=%str(&_debug)
)
%end;
%end; %end;
%else %if &action=CLOSE %then %do; %else %if &action=CLOSE %then %do;
%if %str(&_debug) ge 131 %then %do; %if %str(&_debug) ge 131 %then %do;

View File

@@ -237,8 +237,16 @@ data _null_;
put '%else %if &action=OPEN %then %do; '; put '%else %if &action=OPEN %then %do; ';
put ' /* fix encoding */ '; put ' /* fix encoding */ ';
put ' OPTIONS NOBOMFILE; '; put ' OPTIONS NOBOMFILE; ';
put ' ';
put ' /** ';
put ' * check engine type to avoid the below err message: ';
put ' * > Function is only valid for filerefs using the CACHE access method. ';
put ' */ ';
put ' data _null_; '; put ' data _null_; ';
put ' rc = stpsrv_header(''Content-type'',"text/html; encoding=utf-8"); '; put ' set sashelp.vextfl(where=(fileref="_WEBOUT")); ';
put ' if xengine=''STREAM'' then do; ';
put ' rc=stpsrv_header(''Content-type'',"text/html; encoding=utf-8"); ';
put ' end; ';
put ' run; '; put ' run; ';
put ' '; put ' ';
put ' /* setup json */ '; put ' /* setup json */ ';
@@ -252,16 +260,9 @@ data _null_;
put '%end; '; put '%end; ';
put ' '; put ' ';
put '%else %if &action=ARR or &action=OBJ %then %do; '; put '%else %if &action=ARR or &action=OBJ %then %do; ';
put ' %if &sysver=9.4 %then %do; '; put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt '; put ' ,engine=DATASTEP,dbg=%str(&_debug) ';
put ' ,engine=PROCJSON,dbg=%str(&_debug) '; put ' ) ';
put ' ) ';
put ' %end; ';
put ' %else %do; ';
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
put ' ,engine=DATASTEP,dbg=%str(&_debug) ';
put ' ) ';
put ' %end; ';
put '%end; '; put '%end; ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
put ' %if %str(&_debug) ge 131 %then %do; '; put ' %if %str(&_debug) ge 131 %then %do; ';

View File

@@ -68,8 +68,16 @@
%else %if &action=OPEN %then %do; %else %if &action=OPEN %then %do;
/* fix encoding */ /* fix encoding */
OPTIONS NOBOMFILE; OPTIONS NOBOMFILE;
/**
* check engine type to avoid the below err message:
* > Function is only valid for filerefs using the CACHE access method.
*/
data _null_; data _null_;
rc = stpsrv_header('Content-type',"text/html; encoding=utf-8"); set sashelp.vextfl(where=(fileref="_WEBOUT"));
if xengine='STREAM' then do;
rc=stpsrv_header('Content-type',"text/html; encoding=utf-8");
end;
run; run;
/* setup json */ /* setup json */
@@ -83,16 +91,9 @@
%end; %end;
%else %if &action=ARR or &action=OBJ %then %do; %else %if &action=ARR or &action=OBJ %then %do;
%if &sysver=9.4 %then %do; %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ,engine=DATASTEP,dbg=%str(&_debug)
,engine=PROCJSON,dbg=%str(&_debug) )
)
%end;
%else %do;
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
,engine=DATASTEP,dbg=%str(&_debug)
)
%end;
%end; %end;
%else %if &action=CLOSE %then %do; %else %if &action=CLOSE %then %do;
%if %str(&_debug) ge 131 %then %do; %if %str(&_debug) ge 131 %then %do;