PGamerX-Legacy / muser

Muser: A powerful Discord music bot made in DJs v13 managed by PGamerX, Peiprjs, and Luckie.
https://muser.pgamerx.com
GNU Affero General Public License v3.0
63 stars 12 forks source link

Premium api key invalid status code. #19

Closed sachin-sankar closed 3 years ago

sachin-sankar commented 3 years ago

The status code when a non premium api key is used in a request(ai) is 401 which is same as Unauthorized. Different status code for this type error would be great.

pgamerx commented 3 years ago

The status code when a non premium api key is used in a request(ai) is 401 which is same as Unauthorized. Different status code for this type error would be great.

But I think it's correct Because if you don't have premium then you are unauthorised

sachin-sankar commented 3 years ago

Different status codes for different errors would greatly improve the back end performance of the api

sachin-sankar commented 3 years ago

We can use 402 Response code. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402

pgamerx commented 3 years ago

It Looks like I won't be able to fix it since ExpressJS Doesn't provide that facility in the version I am using. I will upgrade the version once my exams are finished i.e in about a week

pgamerx commented 3 years ago

Check out https://github.com/pgamerxdev/projects/issues/18