Check response type before calling indexOf

resolves #1
Check if body is set before checking pipe
Merge pull request #2 from dejanr/master

Check response type and body before calling childs