diff --git a/.changeset/hip-actors-hide.md b/.changeset/hip-actors-hide.md index 487ce1dc8..2ff6fc7b8 100644 --- a/.changeset/hip-actors-hide.md +++ b/.changeset/hip-actors-hide.md @@ -2,4 +2,5 @@ "ember-resources": patch --- -when using RemoteData, isError should be true when the http status code is >= 400. Resolves #825" +When using RemoteData, isError should be true when the http status code is >= 400. Resolves #825". +Previously, when you had a JSON response with 404 status code, `isError` would be false instead of true. diff --git a/test-app/tests/utils/remote-data/js-test.ts b/test-app/tests/utils/remote-data/js-test.ts index 490fa8f28..0f268eddf 100644 --- a/test-app/tests/utils/remote-data/js-test.ts +++ b/test-app/tests/utils/remote-data/js-test.ts @@ -166,9 +166,9 @@ module('Utils | remote-data | js', function (hooks) { errors: [{ detail: 'Blog not found', status: '404' }], }); assert.false(test.request.isLoading); - assert.false(test.request.isError); + assert.true(test.request.isError, 'isError'); assert.true(test.request.isResolved); - assert.strictEqual(test.request.status, 404); + assert.strictEqual(test.request.status, 404, 'expected status'); }); module('works with non-json requests', function () { @@ -203,7 +203,7 @@ module('Utils | remote-data | js', function (hooks) { assert.strictEqual(test.request.value, 'hello world'); - assert.strictEqual(test.request.status, 200); + assert.strictEqual(test.request.status, 500); }); }); }); @@ -346,7 +346,7 @@ module('Utils | remote-data | js', function (hooks) { errors: [{ detail: 'Blog not found', status: '404' }], }); assert.false(test.request.isLoading); - assert.false(test.request.isError); + assert.true(test.request.isError); assert.true(test.request.isResolved); assert.strictEqual(test.request.status, 404); });