#1954 - Skip buffer calls for unit tests of file_proxy and data_rest.

Moved the "if (TEST_MODE)" statement before the buffer calls in file_proxy and data_rest.
This has no impact on normal use, but will make the unit tests more compatible with different server/PHP configurations.
Note: We do not have to skip setting the headers, which means we can build unit tests around them if we wish.