2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

01_FHEMWEB.pm: allow setting of content-type for XHR commands (jsonlist/xmllist) (Forum #14491)

git-svn-id: https://svn.fhem.de/fhem/trunk@13128 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-01-17 21:40:09 +00:00
parent 9c69cfb4bd
commit 2f63ed879c
3 changed files with 7 additions and 1 deletions

View File

@ -820,7 +820,9 @@ FW_answerCall($)
#If we are in XHR or json mode, execute the command directly
if($FW_XHR || $FW_jsonp) {
$FW_cmdret = $docmd ? FW_fC($cmd, $cmddev) : undef;
$FW_RETTYPE = "text/plain; charset=$FW_encoding";
$FW_RETTYPE = $FW_chash->{contenttype} ?
$FW_chash->{contenttype} : "text/plain; charset=$FW_encoding";
delete($FW_chash->{contenttype});
if($FW_jsonp) {
$FW_cmdret =~ s/'/\\'/g;

View File

@ -70,6 +70,8 @@ CommandJsonList2($$)
my $si = AttrVal("global", "showInternalValues", 0);
my $attr;
$cl->{contenttype} = "application/json; charset=utf-8" if($cl);
if($param) {
my @arg = split(" ", $param);
$attr = $arg[1];

View File

@ -47,6 +47,8 @@ CommandXmlList($$)
my $lt = "";
my %filter;
$cl->{contenttype} = "application/xml; charset=utf-8" if($cl);
my @arr = devspec2array($param ? $param : ".*", $cl); # for Authorize
map { $filter{$_} = 1 } @arr;