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

Refactor interceptors as middlewares #72

Merged
merged 34 commits into from
Jun 6, 2024
Merged

Conversation

djhi
Copy link
Contributor

@djhi djhi commented Jun 4, 2024

  • Refactor interceptors as middlewares
  • Add a Sinon compatible dataProvider in the example
  • Update migration guide
  • Documentation

@djhi djhi added the RFR Ready For Review label Jun 4, 2024
@djhi djhi added WIP Work In Progress and removed RFR Ready For Review labels Jun 5, 2024
@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels Jun 5, 2024
@djhi
Copy link
Contributor Author

djhi commented Jun 5, 2024

I won't upgrade the README in this PR as I intend to rewrite it in a dedicated one

This was referenced Jun 6, 2024
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one thing that we're missing: the ability to use FakeRest directly (as we do in ra-data-fakerest). I don't see any test for that, and I suspect the abstract class doesn't work in that case.

UPGRADE.md Outdated Show resolved Hide resolved
example/fetchMock.ts Outdated Show resolved Hide resolved
src/withDelay.ts Outdated Show resolved Hide resolved
example/fetchMock.ts Outdated Show resolved Hide resolved
example/index.tsx Show resolved Hide resolved
src/BaseServerWithMiddlewares.ts Outdated Show resolved Hide resolved
src/BaseServer.ts Outdated Show resolved Hide resolved
src/BaseServerWithMiddlewares.ts Outdated Show resolved Hide resolved
src/BaseServer.ts Outdated Show resolved Hide resolved
src/FetchMockServer.ts Show resolved Hide resolved
example/index.tsx Outdated Show resolved Hide resolved
src/FakeRest.ts Outdated Show resolved Hide resolved
src/FakeRest.ts Show resolved Hide resolved
src/BaseServer.ts Outdated Show resolved Hide resolved
Comment on lines +31 to +41
throw new Response(
JSON.stringify({
errors: {
title: 'An article with this title already exists. The title must be unique.',
},
}),
{
status: 400,
statusText: 'Title is required',
},
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still use a throw Response here instead of returning an object to test that this still works

Comment on lines +36 to +46
throw new Response(
JSON.stringify({
errors: {
title: 'An article with this title already exists. The title must be unique.',
},
}),
{
status: 400,
statusText: 'Title is required',
},
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still use a throw Response here instead of returning an object to test that this still works

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more remarks, we're getting there!

README.md Outdated Show resolved Hide resolved
src/Collection.ts Outdated Show resolved Hide resolved
src/Collection.ts Outdated Show resolved Hide resolved
src/Database.spec.ts Outdated Show resolved Hide resolved
src/Database.ts Outdated Show resolved Hide resolved
src/BaseServer.ts Outdated Show resolved Hide resolved
@fzaninotto fzaninotto merged commit 2390f79 into master Jun 6, 2024
3 checks passed
@fzaninotto fzaninotto deleted the refactor-interceptors branch June 6, 2024 18:23
@fzaninotto fzaninotto added this to the 4.0.0 milestone Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants