Skip to content

HTTP client does not handle problem+json error responses #1776

Open

Description

@Jayant-kernel

While reviewing the dataset migration, I found that HTTPClient does not handle the new server error format.

The server sends RFC 9457 problem responses as application/problem+json, with a string detail and an optional top-level code.

Currently:

  • application/problem+json is sent to the XML parser.
  • A JSON response with a string detail raises AttributeError, because the client expects detail to be a dictionary.

I reproduced this with a mocked missing-dataset response matching the server tests:

application/problem+json -> OpenMLServerError caused by ExpatError
application/json -> OpenMLServerError caused by AttributeError

This means the response code never reaches the existing exception mapping. For example, code 111 should reach OpenMLServerNoResult.

Could we recognize application/problem+json, read its top-level code and string detail, and keep the current XML and nested JSON formats working? I can take the small compatibility fix and add regression tests.

Related to #1491, which covers the broader exception work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions