Flurl: Make FlurlHttpException.GetResponseString & GetResponseJson asynchronous

Created on 30 Mar 2018  路  1Comment  路  Source: tmenier/Flurl

When Flurl.Http gets a non-successful response, it does an await ReadAsStringAsync on the content before throwing, whether you need it or not, so it can pass the response body along in the FlurlHttpException. The reason it does this ahead of time was convenience - typically you needed to access the error body from a catch block, and at the time C# did not support awaiting in a catch block. That changed with C# 6, which was released in mid-2015. I believe enough time has now passed that we can do away with this inefficiency and and require awaiting those if/when you actually need them.

Breaking changes:

  • FlurlHttpException.GetResponseString will be replaced by FlurlHttpException.GetResponseStringAsync.
  • FlurlHttpException.GetResponseJson will be replaced by FlurlHttpException.GetResponseJsonAsync.
  • HttpCall.ErrorResponseBody will be removed entirely.

These changes are tentative at this point, chime in below if you have concerns.

breaking enhancement

Most helpful comment

For breaking changes you should increment major version - see https://semver.org/.
Developers do not expect breaking changes when they update package with minor version increment.

>All comments

For breaking changes you should increment major version - see https://semver.org/.
Developers do not expect breaking changes when they update package with minor version increment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aw3same picture Aw3same  路  6Comments

cremor picture cremor  路  4Comments

tomasr78 picture tomasr78  路  7Comments

yoshiask picture yoshiask  路  6Comments

nikoudel picture nikoudel  路  6Comments