Skip to content

Commit c4aa0ee

Browse files
committed
Partially roll-back the JSON checks.
1 parent 5bab21c commit c4aa0ee

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/80torture/20json.pl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
# Special values (like inf/nan) should be rejected. Note that these values are
5151
# not technically valid JSON, but extensions that some programming languages
5252
# support automatically.
53+
#
54+
# Note that these tests don't explictely check for M_BAD_JSON since the
55+
# homeserver's parser might not even be able to parse the string.
5356
test "Invalid JSON special values",
5457
requires => [ local_user_and_room_fixtures(
5558
room_opts => { room_version => "6" }
@@ -69,7 +72,7 @@
6972
msgtype => "sytest.dummy",
7073
body => "NaN" + 0,
7174
},
72-
)->main::expect_bad_json,
75+
)->main::expect_http_400,
7376

7477
do_request_json_for( $user,
7578
method => "POST",
@@ -78,7 +81,7 @@
7881
msgtype => "sytest.dummy",
7982
body => "inf" + 0,
8083
},
81-
)->main::expect_bad_json,
84+
)->main::expect_http_400,
8285

8386
do_request_json_for( $user,
8487
method => "POST",
@@ -87,7 +90,7 @@
8790
msgtype => "sytest.dummy",
8891
body => "-inf" + 0,
8992
},
90-
)->main::expect_bad_json,
93+
)->main::expect_http_400,
9194

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

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

113116
$user->http->do_request(
114117
method => "POST",
@@ -118,6 +121,6 @@
118121
},
119122
content => '{"msgtype": "sytest.dummy", "body": NaN}',
120123
content_type => "application/json",
121-
)->main::expect_bad_json,
124+
)->main::expect_http_400,
122125
);
123126
};

0 commit comments

Comments
 (0)