From 880df4138c3a3604b70dfb91ef5ac9c5ab34505e Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Mon, 21 Feb 2022 00:26:03 +0000 Subject: [PATCH] fix: removing wrapper for sasjs webout --- all.sas | 58 +++++++++++++++++++++++++++++++++++++++----- server/ms_webout.sas | 6 ----- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/all.sas b/all.sas index d724a94..7284ecc 100644 --- a/all.sas +++ b/all.sas @@ -18499,6 +18499,58 @@ run; %inc &fref1; %mend mmx_spkexport;/** + @file + @brief Sets the http headers in the SASjs/server response + @details For GET requests, SASjs server will use the file generated by this + macro for setting the appropriate http headers in the response. + + It works by writing a file to the session directory, that is then ingested by + the server. + + The location of this file is driven by the global variable + `sasjs_stpsrv_header_loc` which is made available in the autoexec. + + Usage: + + %mfs_httpheader(Content-type,application/csv) + + @param [in] header_name Name of the http header to set + @param [in] header_value Value of the http header to set + +

Related Macros

+ @li mcf_stpsrv_header.sas + + @version 9.3 + @author Allan Bowe + +**/ + +%macro mfs_httpheader(header_name + ,header_value +)/*/STORE SOURCE*/; +%local fref fid i; + +%if %sysfunc(filename(fref,&sasjs_stpsrv_header_loc)) ne 0 %then %do; + %put &=fref &=sasjs_stpsrv_header_loc; + %put %str(ERR)OR: %sysfunc(sysmsg()); + %return; +%end; + +%let fid=%sysfunc(fopen(&fref,A)); + +%if &fid=0 %then %do; + %put %str(ERR)OR: %sysfunc(sysmsg()); + %return; +%end; + +%let rc=%sysfunc(fput(&fid,%str(&header_name): %str(&header_value))); +%let rc=%sysfunc(fwrite(&fid)); + +%let rc=%sysfunc(fclose(&fid)); +%let rc=%sysfunc(filename(&fref)); + +%mend mfs_httpheader; +/** @file @brief Send data to/from @sasjs/server @details This macro should be added to the start of each web service, @@ -18588,9 +18640,6 @@ run; /* setup json */ data _null_;file &fref encoding='utf-8' termstr=lf; - %if %str(&_debug) ge 131 %then %do; - put '>>weboutBEGIN<<'; - %end; put '{"SYSDATE" : "' "&SYSDATE" '"'; put ',"SYSTIME" : "' "&SYSTIME" '"'; run; @@ -18670,9 +18719,6 @@ run; memsize=quote(cats(memsize)); put ',"MEMSIZE" : ' memsize; put "}" @; - %if %str(&_debug) ge 131 %then %do; - put '>>weboutEND<<'; - %end; run; %end; diff --git a/server/ms_webout.sas b/server/ms_webout.sas index 9cc8026..4a45f08 100644 --- a/server/ms_webout.sas +++ b/server/ms_webout.sas @@ -88,9 +88,6 @@ /* setup json */ data _null_;file &fref encoding='utf-8' termstr=lf; - %if %str(&_debug) ge 131 %then %do; - put '>>weboutBEGIN<<'; - %end; put '{"SYSDATE" : "' "&SYSDATE" '"'; put ',"SYSTIME" : "' "&SYSTIME" '"'; run; @@ -170,9 +167,6 @@ memsize=quote(cats(memsize)); put ',"MEMSIZE" : ' memsize; put "}" @; - %if %str(&_debug) ge 131 %then %do; - put '>>weboutEND<<'; - %end; run; %end;