Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error invalid response returned ? #200

Open
robov opened this issue Sep 13, 2019 · 0 comments
Open

Error invalid response returned ? #200

robov opened this issue Sep 13, 2019 · 0 comments

Comments

@robov
Copy link

robov commented Sep 13, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant