npm / npm/cli

[FEATURE] Show HTTP Body in case of an error, e.g. Bad Request 400

Open
#4,392 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement Needs Discussion
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

What / Why

Using a repository other than the NPM registry, e.g. Gitlab's package registry, there are several different reasons, why HTTP response STATUS codes could be other than 200.

When

  • Try to publish an npm package to a Gitlab's project registry
  • The package has already been published to another Gitlab project on the same instance
  • HTTP Status code will be 400 and the response's body contains the relevant information being "message: 'Validation failed: Package already exists'"
  • NPM registry fetch does hide this information, even when ran in verbose mode, so you only get informed about the HTTP Status code

Where

  • Gitlab's package registry

Current Behavior

You'll only get presented an information like this

npm ERR! code E400
npm ERR! 400 Bad Request - PUT https://someUrl

Expected Behavior

checkErrorsin check-response.js should print the message's body to the console, if not empty and thereby provide more information send by the specific registry system.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in check-response.js at checkErrors, which the issue identifies as the relevant entry point. Reproduce the GitLab package-registry 400 response described in the issue and inspect how the response body is handled. Done means a non-empty error body is shown alongside the HTTP error details without changing the existing status reporting.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.