Skip to content

Commit

Permalink
fix(ui): Import > Postman (fixes #234)
Browse files Browse the repository at this point in the history
  • Loading branch information
flawiddsouza committed Sep 6, 2024
1 parent a23b097 commit 99aa7b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/ui/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,14 +797,14 @@ function handlePostmanV2CollectionItem(postmanCollectionItem: any, parentId: str
postmanCollectionItem.item.forEach((request: any) => {
const requestId = request.id ?? nanoid()
if('item' in request) {
const { requests, plugins: newPlugins } = handlePostmanV2CollectionItem(request, requestId, workspaceId)
const { convertedRequests, plugins: newPlugins } = handlePostmanV2CollectionItem(request, requestId, workspaceId)
plugins.push(...newPlugins)

requests.push({
_id: requestId,
_type: 'request_group',
name: request.name,
children: requests,
children: convertedRequests,
parentId,
workspaceId
})
Expand Down Expand Up @@ -944,15 +944,15 @@ function handlePostmanV2CollectionItem(postmanCollectionItem: any, parentId: str
})
})

return { requests, plugins }
return { convertedRequests: requests, plugins }
}

function importPostmanV2(collections: any[], workspaceId: string) {
const collection: CollectionItem[] = []
const plugins: Plugin[] = []

collections.forEach(postmanCollectionItem => {
const { requests, plugins: newPlugins } = handlePostmanV2CollectionItem(postmanCollectionItem, postmanCollectionItem.info._postman_id, workspaceId)
const { convertedRequests, plugins: newPlugins } = handlePostmanV2CollectionItem(postmanCollectionItem, postmanCollectionItem.info._postman_id, workspaceId)
plugins.push(...newPlugins)

collection.push({
Expand All @@ -963,7 +963,7 @@ function importPostmanV2(collections: any[], workspaceId: string) {
prev[acc.key] = acc.value
return prev
}, {}) : undefined,
children: requests,
children: convertedRequests,
parentId: null,
workspaceId
})
Expand Down

0 comments on commit 99aa7b1

Please sign in to comment.