Skip to content

Response is not valid json content when RDAP returns an error #2

@klkvsk

Description

@klkvsk

When RDAP server returns a protocol error, such as:

{
  "errorCode": 429,
  "title": "Error in processing request",
  "description": [
    "Server is busy now, please try again later.",
    "Too Many Requests"
  ],
  "lang": "en"
}

it results in

InvalidDataTypeException: Response is not valid json content

client fails to assert that due to

if (!is_array($responseJson) || !is_string($responseJson['objectClassName']??null)) {
throw new InvalidDataTypeException(
'Response is not valid json content'
);

objectClassName is not in the response data.
Better to check for rdapConformance that always is in the response of any kind.

But actually best would be to throw a response exception with received code and description.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions