api-library
api-library copied to clipboard
Error invalid response returned ?
When I try to create a new contact with an invalid email I get the following response back The messagepart contains a string and then a json string. I would have expected just the json so I can strip the actual error out of it
`array:2 [▼ "code" => 400 "message" => """ The response has unexpected status code (400).
Response: {
"errors": [
{
"code": 400,
"message": "email: A valid email is required.",
"details": {
"email": [
"A valid email is required."
]
}
}
],
"error": {
"message": "email: A valid email is required. (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.)",
"code": 400,
"details": {
"email": [
"A valid email is required."
]
}
}
}
"""
]`
` private function validate() { if (!in_array($this->info['http_code'], array(200, 201))) { $message = 'The response has unexpected status code ('.$this->info['http_code'].').'; throw new UnexpectedResponseFormatException($this, $message, $this->info['http_code']); }
if ($this->isHtml()) {
throw new UnexpectedResponseFormatException($this);
}
}
`
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.