cdnjs / api-server

📡 API server for api.cdnjs.com - The #1 free and open source CDN built to make life easier for developers.
https://api.cdnjs.com
MIT License
89 stars 38 forks source link

Improve versions metadata logic #58

Closed MattIPv4 closed 2 years ago

MattIPv4 commented 3 years ago

Type of Change

What issue does this relate to?

N/A

What should this PR do?

  1. Removes the unused libraries methods that use the /versions metadata endpoint. This endpoint will include empty versions, so we don't want to rely on it (the /all endpoint will have empty versions filtered).

  2. Updates the libraries method for fetching a version to treat an empty response as a 404.

What are the acceptance criteria?

Fetching a version of a library that would normally result in an empty array being returned will now return a 404 instead.

E.g. https://metadata.speedcdnjs.com/packages/xterm/versions/4.9.0 is a known empty version in metadata, and when fetched via the API server (/libraries/xterm/4.9.0) should now return a 404.