Describe the bug
The /encode endpoint (both GET and POST) does not validate if latitude and longitude are provided. If they are missing, the internal logic throws a TypeError due to undefined arithmetic, which is caught and returned as a 400 error with a confusing message: Cannot read properties of undefined (reading 'NaN').
Steps to reproduce
- Send a POST request to
/digipin/encode with an empty body {}.
- Observe the response.
Expected behavior
The API should explicitly check for missing parameters and return a clear error message like Latitude and Longitude are required.
Actual behavior
Returns {"error": "Cannot read properties of undefined (reading 'NaN')"}.
Screenshot

Describe the bug
The
/encodeendpoint (both GET and POST) does not validate iflatitudeandlongitudeare provided. If they are missing, the internal logic throws aTypeErrordue toundefinedarithmetic, which is caught and returned as a 400 error with a confusing message:Cannot read properties of undefined (reading 'NaN').Steps to reproduce
/digipin/encodewith an empty body{}.Expected behavior
The API should explicitly check for missing parameters and return a clear error message like
Latitude and Longitude are required.Actual behavior
Returns
{"error": "Cannot read properties of undefined (reading 'NaN')"}.Screenshot