Skip to content

Commit

Permalink
Partially roll-back the JSON checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed May 28, 2020
1 parent 5bab21c commit c4aa0ee
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/80torture/20json.pl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
# Special values (like inf/nan) should be rejected. Note that these values are
# not technically valid JSON, but extensions that some programming languages
# support automatically.
#
# Note that these tests don't explictely check for M_BAD_JSON since the
# homeserver's parser might not even be able to parse the string.
test "Invalid JSON special values",
requires => [ local_user_and_room_fixtures(
room_opts => { room_version => "6" }
Expand All @@ -69,7 +72,7 @@
msgtype => "sytest.dummy",
body => "NaN" + 0,
},
)->main::expect_bad_json,
)->main::expect_http_400,

do_request_json_for( $user,
method => "POST",
Expand All @@ -78,7 +81,7 @@
msgtype => "sytest.dummy",
body => "inf" + 0,
},
)->main::expect_bad_json,
)->main::expect_http_400,

do_request_json_for( $user,
method => "POST",
Expand All @@ -87,7 +90,7 @@
msgtype => "sytest.dummy",
body => "-inf" + 0,
},
)->main::expect_bad_json,
)->main::expect_http_400,

# Try some Python magic values.
$user->http->do_request(
Expand All @@ -98,7 +101,7 @@
},
content => '{"msgtype": "sytest.dummy", "body": Infinity}',
content_type => "application/json",
)->main::expect_bad_json,
)->main::expect_http_400,

$user->http->do_request(
method => "POST",
Expand All @@ -108,7 +111,7 @@
},
content => '{"msgtype": "sytest.dummy", "body": -Infinity}',
content_type => "application/json",
)->main::expect_bad_json,
)->main::expect_http_400,

$user->http->do_request(
method => "POST",
Expand All @@ -118,6 +121,6 @@
},
content => '{"msgtype": "sytest.dummy", "body": NaN}',
content_type => "application/json",
)->main::expect_bad_json,
)->main::expect_http_400,
);
};

0 comments on commit c4aa0ee

Please sign in to comment.