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

API: Refactor REST API to enable re-use of functionality. #1471

Merged
merged 1 commit into from Sep 16, 2021

Conversation

hsanjuan
Copy link
Collaborator

This is a preparatory PR to add additional APIs (Pinning Service API) easily
to cluster.

Instead of copy-pasting most of what the REST API does, I have refactored so
that the whole configuration, routing and request-handling utilities can be
re-used.

The worst part has been to divide the test between tests that test core
(common.API) functionality and tests that test specific REST API endpoint
functionality. I could not get away without an additional common/test package
to provide functions that are used from both places. This is a side effect of
testing both http and libp2p endpoints for every request etc.

@hsanjuan hsanjuan added this to the Release v0.14.2 milestone Sep 15, 2021
@hsanjuan hsanjuan self-assigned this Sep 15, 2021
@hsanjuan hsanjuan changed the title API: Refactor REST API. Extract all functionality. API: Refactor REST API to enable re-use of functionality. Sep 15, 2021
@hsanjuan hsanjuan force-pushed the feat/refactor-api branch 4 times, most recently from 0a25ad7 to 4977531 Compare September 15, 2021 20:10
api/common/api.go Outdated Show resolved Hide resolved
api/rest/restapi.go Outdated Show resolved Hide resolved
This is a preparatory PR to add additional APIs (Pinning Service API) easily
to cluster.

Instead of copy-pasting most of what the REST API does, I have refactored so
that the whole configuration, routing and request-handling utilities can be
re-used.

The worst part has been to divide the test between tests that test core
(common.API) functionality and tests that test specific REST API endpoint
functionality. I could not get away without an additional common/test package
to provide functions that are used from both places. This is a side effect of
testing both http and libp2p endpoints for every request etc.
@hsanjuan hsanjuan merged commit 0dfe1ae into master Sep 16, 2021
@hsanjuan hsanjuan deleted the feat/refactor-api branch September 16, 2021 14:10
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

Successfully merging this pull request may close these issues.

None yet

1 participant