Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

feat: search requests by endpoint in personal workspace (#4779)

Pranay Pandeyb9ea5f79161d
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index cbf347613..8887c2238 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -585,17 +585,21 @@ const filteredCollections = computed(() => {
const isMatch = (text: string) => text.toLowerCase().includes(filterText)
+ const isRequestMatch = (request: HoppRESTRequest) =>
+ isMatch(request.name) || isMatch(request.endpoint)
+
for (const collection of collections) {
const filteredRequests = []
const filteredFolders = []
for (const request of collection.requests) {
- if (isMatch(request.name)) filteredRequests.push(request)
+ if (isRequestMatch(request as HoppRESTRequest))
+ filteredRequests.push(request)
}
for (const folder of collection.folders) {
if (isMatch(folder.name)) filteredFolders.push(folder)
const filteredFolderRequests = []
for (const request of folder.requests) {
- if (isMatch(request.name)) filteredFolderRequests.push(request)
+ if (isRequestMatch(request)) filteredFolderRequests.push(request)
}
if (filteredFolderRequests.length > 0) {
const filteredFolder = Object.assign({}, folder)