Improving tests and setting of Location header.