FU: Accept charset argument in JSON request content-type header
This commit is contained in:
parent
ab168bd952
commit
4833456898
1 changed files with 1 additions and 1 deletions
2
FU.pm
2
FU.pm
|
|
@ -689,7 +689,7 @@ sub cookie {
|
||||||
|
|
||||||
sub json {
|
sub json {
|
||||||
shift;
|
shift;
|
||||||
fu->error(400, "Invalid content type for json") if (fu->header('content-type')||'') ne 'application/json';
|
fu->error(400, "Invalid content type for json") if (fu->header('content-type')||'') !~ m{^application/json(?:;\s*charset=utf-?8)?$}i;
|
||||||
return FU::Util::utf8_decode(my $x = $FU::REQ->{body}) if !@_;
|
return FU::Util::utf8_decode(my $x = $FU::REQ->{body}) if !@_;
|
||||||
$FU::REQ->{json} ||= eval {
|
$FU::REQ->{json} ||= eval {
|
||||||
FU::Util::json_parse($FU::REQ->{body}, utf8 => 1)
|
FU::Util::json_parse($FU::REQ->{body}, utf8 => 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue