Skip to content

Client fails to properly handle error cases #10

@mwhouser

Description

@mwhouser

In some error cases, SendWithUs returns a single string with a text/html header.

One such case is when the data payload is too big (over 120 KB). The response is:

Content-Type: text/html

email_data must not exceed 128 kB. Got 143.04 kB

In these cases, the client assumes a JSON body and attempts to deserialize into a JToken. But that fails with an exception:

[System.Net.Http.UnsupportedMediaTypeException: No MediaTypeFormatter is available to read an object of type 'JToken' from content with media type 'text/html'.]
at System.Net.Http.HttpContentExtensions.ReadAsAsyncT(HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)

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