Error invalid response returned ?
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 205
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the private validate() method shown in the issue and reproduce the invalid-email response. Check how the unexpected-status exception exposes the response body, then verify that the returned message provides the JSON error without the surrounding status text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100