Update API to replay statusCode. Added tests. Fixes #6