Skip to content

Support application/problem+json as per RFC 9457 #2424

@lucavenir

Description

@lucavenir

Request Statement

Hello.

RFC 7807, particularly section 6.1. RFC 9457 indicate application/problem+json as a proper header signaling the body will be a json, just like application/json.

The problem is, if we check DioException.response in such cases, we see a jsonDecode-able String.

Solution Brainstorm

We'd like to see application/problem+json automatically decoded, just like application/json. To do so, currently, we could change ResponseType.json to automatically imply that even problem+json will be decoded like so:

enum ResponseType {
  /// Transform the response data to JSON object only when the
  /// content-type of response is "application/json" or "application/problem+json".
  json,
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: dioTargeting `dio` packages: best practiseIt's the best way to do something so fars: featureThis issue indicates a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions