mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +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/fhem@13128 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c3987cf3af
commit
05347a7240
@ -820,7 +820,9 @@ FW_answerCall($)
|
|||||||
#If we are in XHR or json mode, execute the command directly
|
#If we are in XHR or json mode, execute the command directly
|
||||||
if($FW_XHR || $FW_jsonp) {
|
if($FW_XHR || $FW_jsonp) {
|
||||||
$FW_cmdret = $docmd ? FW_fC($cmd, $cmddev) : undef;
|
$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) {
|
if($FW_jsonp) {
|
||||||
$FW_cmdret =~ s/'/\\'/g;
|
$FW_cmdret =~ s/'/\\'/g;
|
||||||
|
@ -70,6 +70,8 @@ CommandJsonList2($$)
|
|||||||
my $si = AttrVal("global", "showInternalValues", 0);
|
my $si = AttrVal("global", "showInternalValues", 0);
|
||||||
my $attr;
|
my $attr;
|
||||||
|
|
||||||
|
$cl->{contenttype} = "application/json; charset=utf-8" if($cl);
|
||||||
|
|
||||||
if($param) {
|
if($param) {
|
||||||
my @arg = split(" ", $param);
|
my @arg = split(" ", $param);
|
||||||
$attr = $arg[1];
|
$attr = $arg[1];
|
||||||
|
@ -47,6 +47,8 @@ CommandXmlList($$)
|
|||||||
my $lt = "";
|
my $lt = "";
|
||||||
my %filter;
|
my %filter;
|
||||||
|
|
||||||
|
$cl->{contenttype} = "application/xml; charset=utf-8" if($cl);
|
||||||
|
|
||||||
my @arr = devspec2array($param ? $param : ".*", $cl); # for Authorize
|
my @arr = devspec2array($param ? $param : ".*", $cl); # for Authorize
|
||||||
map { $filter{$_} = 1 } @arr;
|
map { $filter{$_} = 1 } @arr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user