log in using fitnesse
- by user1513027
This is a basic HTTP encoding and formatting question.
I need to log in from a RESTFixture to a PHP web service.
I need to pass in the account, username, and password, as POST variables
just as a login page does.
Wireshark shows that my login page formats it as
accountNumber=accounttest&username=usertest&password=passtest
When I do that in the test, I get a POST array of
$_POST: Array
(
[accountNumber] => accounttest
[amp;username] => usertest
[amp;password] => passtest
)
That would work but the "amp;" obviously makes it so that PHP doesn't find the username.
Content type is the same for both live and the test.
[CONTENT_TYPE] = application/x-www-form-urlencoded
Here are a few other formats I've tried with results. In all three cases, it fails to parse so all fields end up in one array entry.
input: accountNumber=accounttest%amp;username=usertest%amp;password=passtest
Result: $_POST: Array
(
[accountNumber] = accounttest%amp;username=usertest%amp;password=passtest
)
input: accountNumber=accounttest;username=usertest;password=passtest
Result: $_POST: Array
(
[accountNumber] => accounttest;username=usertest;password=passtest
)
input: accountNumber=accounttest%26username=usertest%26password=passtest
Result: $_POST: Array
(
[accountNumber] = accounttest&username=usertest&password=passtest
)
So the last one correctly converts the %26 to &, but doesn't break the items apart
into array elements.