Made the required changes 

If you `request` is `null` then you will return a blank response. Ideally you should throw `ArgumentException` so that it can be handled and proper response is sent to end user.