Well, “created script”:
$method = $_SERVER['REQUEST_METHOD'];
switch($method) {
case 'PUT':
echo 'put method';
break;
case 'GET':
echo 'get method';
break;
case 'POST':
echo 'post method';
break;
case 'DELETE':
echo 'delete method';
default:
echo 'valid method\'s: PUT, GET, POST, DELETE';
}
- What’s is best/simplest way to test each method ?
Wanna test them because actually in each method exist different task.
Write a script that makes one or more HTTP requests (containing known data) for each method to the URI that the script you are testing resides at.
After each request the script should check that the response is as you expect it and that any side effects (such as the creation of files on the server, or entries in a database have changed) are as you expect.