Skip to content

Commit 643dfd3

Browse files
author
Jared Hendrickson
committed
Defaulted empty content-type header to application/x-www-form-urlencoded
1 parent caedd86 commit 643dfd3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

pfSense-pkg-API/files/etc/inc/api/framework/APITools.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function get_request_data() {
3535
# TODO: x-www-form-urlencoded still attempts to use json if no parameters were passed in. This was intentionally done to
3636
# TODO: support user scripts that didn't specify a static content type (before it was supported) remove this in a future
3737
# TODO: release. It is preferred that content uses a specified content type.
38+
$_SERVER["HTTP_CONTENT_TYPE"] = (empty($_SERVER["HTTP_CONTENT_TYPE"])) ? "application/x-www-form-urlencoded" : $_SERVER["HTTP_CONTENT_TYPE"];
3839
$content_types = [
3940
"application/json" => json_decode(file_get_contents('php://input'), true),
4041
"application/x-www-form-urlencoded" => (empty($_GET)) ? json_decode(file_get_contents('php://input'), true) : $_GET

0 commit comments

Comments
 (0)