Skip to content

Automatically guess content-type if one is not provided #5

@MasterOdin

Description

@MasterOdin

Right now, if no content-type is not provided, the receiver will just assume that it's receiving a Buffer. This limits the usefulness of the automatic parsing when dealing with legacy code as the receiver then basically always has to specify {contentType: 'application/json'}.

Instead of this manual step for unknown content types, it would be better for @cisl/io to try and guess the content type if it's not provided by doing something like:

try {
  content = content.toString();
  content = JSON.parse(content);
}
catch {
  // do nothing
}

return content;

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions