Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.1.0
-
None
-
Unknown
Description
When json response is received from the external REST endpoint using camel-http component, it fails to read missing json value, although DEFAULT_PATH_LEAF_TO_NULL option is set.
This can be reproduced using mockable.io service, but we noticed this behavior when calling many other REST endpoints (from real implementations).
How to reproduce:
- Create mocked POST REST endpoint using mockable.io
- For example, our looks like following:
`POST http://demo0405481.mockable.io/camel`
Response: {"errorcode":0,"errormessage":""} - Create integration where REST endpoint from step 2. is called using camel-http
- Read missing summary field using Set Property and Jsonpath with DEFAULT_PATH_LEAF_TO_NULL enabled
- Observe the error "Cannot read message body as supported JSON value. "
Actual result:
org.apache.camel.ExpressionEvaluationException: org.apache.camel.CamelExchangeException: Cannot read message body as supported JSON value.
Expected result:
${exchangeProperty.summary} to be null
YAML DSL to reproduce:
- route: nodePrefixId: route-7e2 id: route-dafc from: uri: scheduler id: from-64dc parameters: name: scheduler repeatCount: 2 steps: - setHeader: name: Content-Type expression: simple: expression: application/json id: simple-dc79 id: setHeader-2f26 - setBody: expression: simple: expression: |- { "some": "value" } id: simple-bfca id: setBody-243c - to: uri: http id: to-2cfa parameters: httpUri: demo0405481.mockable.io/camel httpMethod: POST - setProperty: name: summary expression: jsonpath: expression: $.summary option: DEFAULT_PATH_LEAF_TO_NULL id: jsonpath-54df id: setProperty-0d81 - log: message: 'Value: ${exchangeProperty.summary}' id: log-6839
Additional notes:
- Please create your own mock using mockable.io and create some POST REST endpoint and return any json you want
- In case summary field exists, it reads it normally
- In case body is set using Set Body component, instead of reading it from from REST endpoint, everything works fine
Attachments
Issue Links
- links to