chemokita13 / beReal-api

A not official BeReal rest API in wich you can get all posts info, comment, upload a post...
https://berealapi.fly.dev
78 stars 5 forks source link

Update Error Code on JSON root #6

Closed basti394 closed 1 year ago

basti394 commented 1 year ago

When I request any endpoint (in this example /login/verify) and endpoint returns error code, please provide it on root, instead of 500.

Example:

{
    "status": 500,
    "message": "Internal server error",
    "data": {
        "response": {
            "status": 400,
            "message": "OTP not verified",
            "data": {
                "error": {
                    "code": 400,
                    "message": "SESSION_EXPIRED",
                    "errors": [
                        {
                            "message": "SESSION_EXPIRED",
                            "domain": "global",
                            "reason": "invalid"
                        }
                    ]
                }
            }
        },
        "status": 400,
        "message": "OTP not verified",
        "name": "HttpException"
    }
}

Please put 400 instead of 500 :)

chemokita13 commented 1 year ago

This is because the code when throws a 500 http code writes in data the response of the befake module, I will change that !

chemokita13 commented 1 year ago

Solved in the last commit