Skip to content

bytes and application/json content type inconistencies #4107

Open
@timotheeguerin

Description

@timotheeguerin

If you have both of those they get treated differently

op a(@header contentType: "application/json;charset=utf-8", @body body: bytes): void;
op b(@header contentType: "application/json", @body body: bytes): void;

in the first case it see is as a binary payload(that should be json)
in the 2nd is see it as a json base64 encoded string of the value passed

Playground Link

There is a few things that are established that result in this behavior

  • default content type is application/json
  • bytes in a json object is a base64 encoded string of the bytes
  • we only do this special treatment if content type is exactly application/json

Maybe we need to parse the content type to figure out the real media type without the attributes
However it is also weird that you can't just say this is a json file without defining the structure of it

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions