8000 fix: use npmFetch() instead of npmFetch.json() for team destroy command by heisantosh · Pull Request #6161 · npm/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: use npmFetch() instead of npmFetch.json() for team destroy command #6161

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

Merged
merged 6 commits into from
Feb 14, 2023

Conversation

heisantosh
Copy link
Contributor
@heisantosh heisantosh commented Feb 13, 2023

The registry returns a HTTP 204 status and an empty body on success for the npm team destroy <org>:<team> command. Using npmFetch.json() makes the CLI error out on completion even though the action was completed successfully in the registry.

Using npmFetch() will not attempt to parse the response body as JSON.

The registry returns a 204 status and an empty body on success for the
team destroy command. Using npmFetch.json() makes the CLI error out on
completion even though the action was completed successfully in the
registry.
@heisantosh heisantosh requested a review from a team as a code owner February 13, 2023 12:37
@heisantosh heisantosh requested review from lukekarrys and removed request for a team February 13, 2023 12:37
@heisantosh heisantosh marked this pull request as draft February 13, 2023 12:59 8000
@heisantosh
Copy link
Contributor Author

Looks like I have to publish a new version of libnpmteam and also update the test cases for the team destroy command.

@heisantosh heisantosh force-pushed the no-fetchjson-for-team-destroy branch from 68f511e to 65475ce Compare February 13, 2023 13:29
Return a value of empty JSON {} object to have a known response for the
empty response body. Otherwise the npmFetch returns the Body object from
minipass package.
@heisantosh heisantosh marked this pull request as ready for review February 13, 2023 14:22
@wraithgar
Copy link
Member

It'd be good if we caught the correct behavior in the tests. Can you remove the {} from the 204 responses in the test file test/index.js?

@wraithgar
Copy link
Member

Fixed PR to use same delete behavior as libnpmaccess

@wraithgar wraithgar merged commit 11e6cc9 into npm:latest Feb 14, 2023
@github-actions github-actions bot mentioned this pull request Feb 14, 2023
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.

3 participants
0