Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleCanned Responses JSON
linenumberstrue
  "cannedresponses": [
    {
      "response.name": "plain ok",
      "response.headers": [{
        "name": "Server",
        "value": "hidden"
      }],
      "response.reason": "OK",
      "response.status": 200
    },
    {
      "response.contenttype": "%{script:if (state.httpExchange.getRequestHeaders().getFirst('Content-Type') == 'application/json') 'application/json'; else 'text/html';}",
      "response.name": "Access Denied",
      "response.reason": "Invalid or missing credentials",
      "response.status": 403,
      "response.content": "%{script:if (state.httpExchange.getRequestHeaders().getFirst('Content-Type') == 'application/json') '{\"error\":\"access.denied\"\\}'; else '<html><head><title>No access<\/title><body><h1>Invalid credentials<\/h1><\/body><\/html>';}"
    }
  ]


Configuration

...

Using Ceptor Console

If you press Add, you get to fill in the details for this response like this:

...