From a39f4e4eee32eecd76851c688ac485fca40ee5d9 Mon Sep 17 00:00:00 2001 From: munja Date: Thu, 28 Apr 2022 21:47:23 +0100 Subject: [PATCH] fix: ensuring test passes for mfs_httpheader --- server/mfs_httpheader.sas | 3 ++- tests/serveronly/mfs_httpheader.test.sas | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/server/mfs_httpheader.sas b/server/mfs_httpheader.sas index 3a4eefb..972f1b0 100644 --- a/server/mfs_httpheader.sas +++ b/server/mfs_httpheader.sas @@ -12,7 +12,7 @@ Usage: - %mfs_httpheader(Content-type,application/csv) + %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 @@ -28,6 +28,7 @@ %macro mfs_httpheader(header_name ,header_value )/*/STORE SOURCE*/; +%global sasjs_stpsrv_header_loc; %local fref fid i; %if %sysfunc(filename(fref,&sasjs_stpsrv_header_loc)) ne 0 %then %do; diff --git a/tests/serveronly/mfs_httpheader.test.sas b/tests/serveronly/mfs_httpheader.test.sas index 2874907..e2a2d95 100644 --- a/tests/serveronly/mfs_httpheader.test.sas +++ b/tests/serveronly/mfs_httpheader.test.sas @@ -9,11 +9,12 @@ **/ +%let orig_sasjs_stpsrv_header_loc=&sasjs_stpsrv_header_loc; %let sasjs_stpsrv_header_loc=%sysfunc(pathname(work))/header.txt; %mp_assertscope(SNAPSHOT) -%mfs_httpheader(Content-type,application/csv) -%mp_assertscope(COMPARE) +%mfs_httpheader(Content-Type,application/csv) +%mp_assertscope(COMPARE,ignorelist=sasjs_stpsrv_header_loc) data _null_; infile "&sasjs_stpsrv_header_loc"; @@ -27,12 +28,12 @@ run; outds=work.test_results ) %mp_assert( - iftrue=("&test1"="Content-type: application/csv"), + iftrue=("&test1"="Content-Type: application/csv"), desc=Checking line was created, outds=work.test_results ) -%mfs_httpheader(Content-type,application/text) +%mfs_httpheader(Content-Type,application/text) %let test2=0; data _null_; infile "&sasjs_stpsrv_header_loc"; @@ -46,12 +47,11 @@ run; outds=work.test_results ) %mp_assert( - iftrue=("&test2"="Content-type: application/text"), + iftrue=("&test2"="Content-Type: application/text"), desc=Checking line was created, outds=work.test_results ) /* reset header so the test will pass */ - -%mfs_httpheader(Content-type,application/json) \ No newline at end of file +%let sasjs_stpsrv_header_loc=&orig_sasjs_stpsrv_header_loc; \ No newline at end of file