Added proper handling for 405 errors

Change-Id: Ib40596388a5b028b86356ec66944a5a177883fd7
Merge "Added proper handling for 405 errors"