Skip to content

Send 404 when the resource or author is not found #48

@itaquito

Description

@itaquito

Hello!

Right now when you search for a resource/author that doesn't exist you get an interesting response:

{
  "id": null,
  "title": null,
  "tag": null,
  "current_version": null,
  "native_minecraft_version": null,
  "supported_minecraft_versions": null,
  "icon_link": "https://www.spigotmc.org/styles/default/xenresource/resource_icon.png",
  "author": {
    "id": null,
    "username": null
  },
  "premium": {
    "price": null,
    "currency": null
  },
  "stats": {
    "downloads": null,
    "updates": null,
    "reviews": {
      "unique": null,
      "total": null
    },
    "rating": null
  },
  "description": null
}
{
  "id": null,
  "username": null,
  "resource_count": null,
  "identities": {},
  "avatar": "https://www.spigotmc.org/styles/spigot/xenforo/avatars/avatar_male_l.png"
}

My suggestion is just adding a 404 error when this happens:

{"code":404,"message":"Resource not found."}

By doing this way, we (devs that use the API) can easily catch the error rather than checking if a value is null.

Also.... Thanks for this amazing tool.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions