Update index.js

Some APIs return ' ' on a 201 response resulting in a deserialization exception. Let's trim the response and then check the length to account for 'empty' responses.