Skip to content

fix: return 404 when requesting not existing exact version#37

Merged
antfu merged 1 commit intoantfu:mainfrom
ElshadHu:fix-semantic-version
Apr 13, 2026
Merged

fix: return 404 when requesting not existing exact version#37
antfu merged 1 commit intoantfu:mainfrom
ElshadHu:fix-semantic-version

Conversation

@ElshadHu
Copy link
Copy Markdown
Contributor

@ElshadHu ElshadHu commented Apr 5, 2026

Summary

This PR is relate to the PR I made in npmx: npmx-dev/npmx.dev#2383

Fixes a bug where requesting a non-existent exact version (e.g. axios@150.150.150) returned HTTP 200 and echoed back the version string instead of returning a 404.

Changes

  • routes/[...pkg].ts
    when spec.type === 'version', check the version exists in data.versionsMeta and throw a 404 if not.
  • handle.ts
    fix batch error status propagation: read error.statusCode ?? error.status so errors are not downgraded to 400.
  • index.test.ts
    add test for non-existent exact version, update pre-release test to use a version that actually exists in the registry.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 5, 2026

Deploy Preview for npm-meta-info ready!

Name Link
🔨 Latest commit 41b0afd
🔍 Latest deploy log https://app.netlify.com/projects/npm-meta-info/deploys/69d1ce7657d0ae000835d73e
😎 Deploy Preview https://deploy-preview-37--npm-meta-info.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu antfu merged commit 5b5fa89 into antfu:main Apr 13, 2026
4 checks passed
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.

2 participants