Converting All the Error Messages To JSON Format in WSO2 Microgateway 3.2.0

Option 1: Using interceptors

Option 2: Using filter extensions

Therefore, we are going to use Option 2 to achieve our requirement easily.

  1. Write the custom filter logic in the ballerina language and save the content in a file with a .bal extension.
name = "ExtensionFilter"
position = 1
  1. 404: Incorrect HTTP Method used (Received response: method not allowed)
  2. 405: Invalid resource URL (Received response: no matching resource found for path : resource_path , method : http_method)

Customize 404 and 405 responses

apiFaultResponses = true
globalFaultResponses = true



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store