@sasjs/core 4.8.0 → 4.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,13 +12,14 @@
12
12
  The macro is idempotent - if you run it twice, it will only create a folder
13
13
  once.
14
14
 
15
- usage:
15
+ Usage:
16
16
 
17
17
  %mm_createfolder(path=/some/meta/folder)
18
18
 
19
19
  @param [in] path= Name of the folder to create.
20
20
  @param [in] mdebug= set DBG to 1 to disable DEBUG messages
21
21
 
22
+
22
23
  @version 9.4
23
24
  @author Allan Bowe
24
25
 
@@ -12,7 +12,7 @@
12
12
  This macro is idempotent - if you run it twice, it will only create an STP
13
13
  once.
14
14
 
15
- usage (type 1 STP):
15
+ Usage (type 1 STP):
16
16
 
17
17
  %mm_createstp(stpname=MyNewSTP
18
18
  ,filename=mySpecialProgram.sas
@@ -31,7 +31,8 @@
31
31
  putlog (_all_)(=);
32
32
  run;
33
33
 
34
- usage (type 2 STP):
34
+ Usage (type 2 STP):
35
+
35
36
  %mm_createstp(stpname=MyNewType2STP
36
37
  ,filename=mySpecialProgram.sas
37
38
  ,directory=SASEnvironment/SASCode/STPs
@@ -74,8 +75,9 @@
74
75
  @li mf_verifymacvars.sas
75
76
  @li mm_getdirectories.sas
76
77
  @li mm_updatestpsourcecode.sas
77
- @li mp_dropmembers.sas
78
78
  @li mm_getservercontexts.sas
79
+ @li mp_abort.sas
80
+ @li mp_dropmembers.sas
79
81
 
80
82
  <h4> Related Macros </h4>
81
83
  @li mm_createwebservice.sas
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "@sasjs/cli": "3.6.0",
37
37
  "@sasjs/core": "4.4.7"
38
38
  },
39
- "version": "4.8.0"
39
+ "version": "4.9.3"
40
40
  }
@@ -0,0 +1,52 @@
1
+ /**
2
+ @file
3
+ @brief Sets the http headers in the SASjs/server response
4
+ @details For GET requests, SASjs server will use the file generated by this
5
+ macro for setting the appropriate http headers in the response.
6
+
7
+ It works by writing a file to the session directory, that is then ingested by
8
+ the server.
9
+
10
+ The location of this file is driven by the global variable
11
+ `sasjs_stpsrv_header_loc` which is made available in the autoexec.
12
+
13
+ Usage:
14
+
15
+ %mfs_httpheader(Content-type,application/csv)
16
+
17
+ @param [in] header_name Name of the http header to set
18
+ @param [in] header_value Value of the http header to set
19
+
20
+ <h4> Related Macros </h4>
21
+ @li mcf_stpsrv_header.sas
22
+
23
+ @version 9.3
24
+ @author Allan Bowe
25
+
26
+ **/
27
+
28
+ %macro mfs_httpheader(header_name
29
+ ,header_value
30
+ )/*/STORE SOURCE*/;
31
+ %local fref fid i;
32
+
33
+ %if %sysfunc(filename(fref,&sasjs_stpsrv_header_loc)) ne 0 %then %do;
34
+ %put &=fref &=sasjs_stpsrv_header_loc;
35
+ %put %str(ERR)OR: %sysfunc(sysmsg());
36
+ %return;
37
+ %end;
38
+
39
+ %let fid=%sysfunc(fopen(&fref,A));
40
+
41
+ %if &fid=0 %then %do;
42
+ %put %str(ERR)OR: %sysfunc(sysmsg());
43
+ %return;
44
+ %end;
45
+
46
+ %let rc=%sysfunc(fput(&fid,%str(&header_name): %str(&header_value)));
47
+ %let rc=%sysfunc(fwrite(&fid));
48
+
49
+ %let rc=%sysfunc(fclose(&fid));
50
+ %let rc=%sysfunc(filename(&fref));
51
+
52
+ %mend mfs_httpheader;
@@ -33,8 +33,9 @@
33
33
  `,"$tablename":{"formats":{"col1":"$CHAR1"},"types":{"COL1":"C"}}`
34
34
 
35
35
  <h4> SAS Macros </h4>
36
- @li mp_jsonout.sas
37
36
  @li mf_getuser.sas
37
+ @li mp_jsonout.sas
38
+ @li mfs_httpheader.sas
38
39
 
39
40
  <h4> Related Macros </h4>
40
41
  @li mv_webout.sas
@@ -86,11 +87,11 @@
86
87
  /* fix encoding */
87
88
  OPTIONS NOBOMFILE;
88
89
 
90
+ /* set the header */
91
+ %mfs_httpheader(Content-type,application/json)
92
+
89
93
  /* setup json */
90
94
  data _null_;file &fref encoding='utf-8' termstr=lf;
91
- %if %str(&_debug) ge 131 %then %do;
92
- put '>>weboutBEGIN<<';
93
- %end;
94
95
  put '{"SYSDATE" : "' "&SYSDATE" '"';
95
96
  put ',"SYSTIME" : "' "&SYSTIME" '"';
96
97
  run;
@@ -170,9 +171,6 @@
170
171
  memsize=quote(cats(memsize));
171
172
  put ',"MEMSIZE" : ' memsize;
172
173
  put "}" @;
173
- %if %str(&_debug) ge 131 %then %do;
174
- put '>>weboutEND<<';
175
- %end;
176
174
  run;
177
175
  %end;
178
176