mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +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:
parent
9c69cfb4bd
commit
2f63ed879c
@ -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;
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user