sasjs / server

Build Apps on Base SAS
https://server.sasjs.io
MIT License
20 stars 3 forks source link

header file not being reset #152

Closed allanbowe closed 2 years ago

allanbowe commented 2 years ago

When resetting a header, it seems that the final value is not being applied

To reproduce, add the following code to a SAS file in Drive:

filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;
%mfs_httpheader(Content-Type, application/text)
%mfs_httpheader(Content-Type, application/json)

The Content-Type in the response should be application/json, but instead it's application/text.

On further testing, it seems this bug is only with application/json - the following code works fine:

filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

%mfs_httpheader(Content-Type, application/json)
%mfs_httpheader(Content-Type, something/unique)

See #58 for more details on the original development.

allanbowe commented 2 years ago

Closing - actually the bug was on the SAS side, the header file (sasjs_stpsrv_header_loc variable) was being redirected.

Commit fix: https://github.com/sasjs/core/commit/a39f4e4eee32eecd76851c688ac485fca40ee5d9