TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.72k stars 1.09k forks source link

enhancement: support rfc7807 problem+json standards based error responses #2291

Closed asoorm closed 4 years ago

asoorm commented 5 years ago

Do you want to request a feature or report a bug?

feature

What is the current behavior?

Errors returned from the gateway are not in a standards based format

What is the expected behavior?

If the client accept header contains application/problem+json, content negotiation should allow us to return a problem+json response

https://tools.ietf.org/html/rfc7807

# Example req
curl -X POST http://tyk.gatway/httpbin/post -H 'Accept: application/json, application/problem+json' -d '{"some": {"invalid": "request_body"}}'

# Example res
{
  "type": "https://example.com/validation-error",
  "title": "Invalid Request.",
  "code": 422
    "invalid-params": [
      {
         "name": "name",
         "reason": "name is required"
       },
       {
        "name": "age",
        "reason": "age is required"
      }
    ]
 }

Which versions of Tyk affected by this issue? Did this work in previous versions of Tyk?

all

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, please add comments to this ticket if you would like it to stay open. Thank you for your contributions.