mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #3242] [MERGED] refactor: move from network strategies to generic interceptor service #4298
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#4298
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/3242
Author: @AndrewBastin
Created: 8/5/2023
Status: ✅ Merged
Merged: 8/21/2023
Merged by: @AndrewBastin
Base:
release/2023.8.0← Head:refactor/interceptor-service📝 Commits (5)
974a984refactor: move from network strategies to generic interceptor serviceeeee48afix: currentInterceptorID cannot be set to null if there are interceptorsf870c57chore: introduce tests for interceptor service9b969e4feat: add ability for interceptors to subtitles on the selectorcc7f6cdchore: add comments to the new services📊 Changes
33 files changed (+1468 additions, -1312 deletions)
View changed files
📝
packages/hoppscotch-common/locales/en.json(+1 -0)📝
packages/hoppscotch-common/src/components.d.ts(+3 -0)📝
packages/hoppscotch-common/src/components/app/Interceptor.vue(+26 -76)📝
packages/hoppscotch-common/src/components/graphql/Request.vue(+5 -2)📝
packages/hoppscotch-common/src/components/graphql/RequestOptions.vue(+5 -2)📝
packages/hoppscotch-common/src/components/http/Request.vue(+14 -15)➕
packages/hoppscotch-common/src/components/interceptors/ExtensionSubtitle.vue(+39 -0)➕
packages/hoppscotch-common/src/components/settings/Extension.vue(+88 -0)➕
packages/hoppscotch-common/src/components/settings/Proxy.vue(+94 -0)📝
packages/hoppscotch-common/src/helpers/GQLConnection.ts(+26 -7)📝
packages/hoppscotch-common/src/helpers/RequestRunner.ts(+111 -88)📝
packages/hoppscotch-common/src/helpers/network.ts(+71 -153)➖
packages/hoppscotch-common/src/helpers/strategies/AxiosStrategy.ts(+0 -163)➖
packages/hoppscotch-common/src/helpers/strategies/ExtensionStrategy.ts(+0 -128)➖
packages/hoppscotch-common/src/helpers/strategies/__tests__/AxiosStrategy-NoProxy.spec.js(+0 -76)➖
packages/hoppscotch-common/src/helpers/strategies/__tests__/AxiosStrategy-Proxy.spec.js(+0 -145)➖
packages/hoppscotch-common/src/helpers/strategies/__tests__/ExtensionStrategy-NoProxy.spec.js(+0 -212)📝
packages/hoppscotch-common/src/helpers/types/HoppRESTResponse.ts(+1 -1)➖
packages/hoppscotch-common/src/modules/hoppExtension.ts(+0 -58)➕
packages/hoppscotch-common/src/modules/interceptors.ts(+46 -0)...and 13 more files
📄 Description
Closes HFE-110
This PR intends to replace the Network Strategy system for implementing Interceptors with a generic Interceptor Service system. The new system intends to remove any 'special features' that the interceptors are provided and instead lets Hoppscotch Common codebase look at interceptors under a defined generic definition, with which, interceptor implementations are abstracted from the common codebase.
What's changed
InterceptorServiceto which interceptors can be registered against and also keeps track of which is the currently selected interceptor.createHoppAppalong with the ability to specify the default interceptor that should be activated.disabled(via theselectablefield) and give the reason why they might not be selected.PROXY_ENABLEDandEXTENSIONS_ENABLEDfield forCURRENT_INTERCEPTOR_IDfield along with migrations on settings object for the same.HOPP_REQUEST_RUNto accept any arbitrary string forstrategyfield.HoppModuledefinition and similar bits) into the them.createRESTNetworkStreamandrunRESTRequest$along with similar functions on the network execution stack that we are working towards that.pages/settingsinto separateSettingsProxyandSettingsExtensioncomponents respectively.cancellationwiring to be independent and not global across all running requests. (NOTE: Although the new Interceptor Service and the requesting stack in general supports the individual cancellation mechanisms, some systems like extension doesn't play with it well and is universalised in cancellation as a half measure).Checks
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.