Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client fails to properly handle error cases #10

Open
mwhouser opened this issue Jun 14, 2016 · 0 comments
Open

Client fails to properly handle error cases #10

mwhouser opened this issue Jun 14, 2016 · 0 comments

Comments

@mwhouser
Copy link

mwhouser commented Jun 14, 2016

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant