Fuel: API Request: graceful handling of 304

Created on 9 Jul 2018  路  3Comments  路  Source: kittinunf/fuel

Linking the old ticket #191,

When using Fuel and setting If-None-Match manually, when the server returns a 304, currently an HttpException is raised, whereas this is actually expected. The happy-path shouldn't be "exceptional". When a 204 (No Content) is returned, Fuel doesn't complain unless you try to deserialize.

As it stands, by default redirectResponseInterceptor will not match the 304 (which is correct), followed by the validatorResponseInterceptor will error as it's not included in the default validRange. Only the 200-299 range is handled as valid, whereas 100-399 should be considered valid; only 400-599 are error codes.
https://github.com/kittinunf/Fuel/blob/56cf7ce2af6ea39b2fb013564d188a812c42cf55/fuel/src/main/kotlin/com/github/kittinunf/fuel/core/FuelManager.kt#L58

The default should not indicate something is an error when it's not (304, 300, 103, ...).
RxJS used to have the same issue, but this was fixed: https://github.com/ReactiveX/rxjs/issues/3308

bug

Most helpful comment

I will take this.

All 3 comments

I will take this.

@SleeplessByte @kittinunf can we close this now?

No, I will take this as well 馃挭

Was this page helpful?
0 / 5 - 0 ratings

Related issues

easazade picture easazade  路  6Comments

iNoles picture iNoles  路  5Comments

Jirayu4R7 picture Jirayu4R7  路  3Comments

erikthered picture erikthered  路  7Comments

IvanKulikov picture IvanKulikov  路  5Comments