Separate invalid request and parse error  logic

Previously parse error was hidden by invalid request the logic is now
fixed to handle both case and test files are updated.

Signed-off-by: Vasudev Kamath <kamathvasudev@gmail.com>