Skip to content

Commit

Permalink
tests: Verify the URLRequest method setter can throw
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed Feb 6, 2024
1 parent cadae93 commit 95f5701
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/tests/swfs/avm2/urlrequest/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package {
import flash.display.Sprite;
public class Test extends Sprite {
}
}

import flash.net.*;

var request = new URLRequest();

request.url = null;

var methods = ["GET", "get", "Get", "POST", "post", "PoST", "PUT", "put", "DELETE"];
for each (var method in methods) {
trace("// '" + method + "' method");
try {
request.method = method;
trace("request.method: " + request.method);
} catch (e) {
trace("error: " + e);
}
}
18 changes: 18 additions & 0 deletions tests/tests/swfs/avm2/urlrequest/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 'GET' method
request.method: GET
// 'get' method
request.method: get
// 'Get' method
error: ArgumentError: Error #2008: Parameter method must be one of the accepted values.
// 'POST' method
request.method: POST
// 'post' method
request.method: post
// 'PoST' method
error: ArgumentError: Error #2008: Parameter method must be one of the accepted values.
// 'PUT' method
error: ArgumentError: Error #2008: Parameter method must be one of the accepted values.
// 'put' method
error: ArgumentError: Error #2008: Parameter method must be one of the accepted values.
// 'DELETE' method
error: ArgumentError: Error #2008: Parameter method must be one of the accepted values.
Binary file added tests/tests/swfs/avm2/urlrequest/test.swf
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/urlrequest/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_frames = 1

0 comments on commit 95f5701

Please sign in to comment.