We have a test where we pass a JSON object to an endpoint object. The object created in katalon studio passed the JSON object right on through to the endpoint
This test is passing when run in Katalon 6.3.0.rc7, but if we run it in Katalon 6.3.3 it fails with the error message
JSON parse error: Unexpected character ('n' (code 110)): was expecting comma to separate Object entries
To be clear, the enpoint of our microservice is throwing this error, and Katalon fails the test when the api call returns a 400 instead of a 200ā¦
To me it looks like the message being sent to the endpoint is not identical. It seems extra characters are being added to the request object before it leaves Katalon.
Is anyone experiencing this problem?
Is there a way to have the request object printed out so I can see what is actually being sent?
The problem is that the test passes with a 200 in 6.3.0, but i get a 400 in 6.3.3.
Nothing else changes. The test does not change, so I would not expect a different result
this is why I suggested that always to check for response code, before to attempt to parse the json, to avoid code crashes.
Now, to the issue ā¦ how does the URL of your API request looks like? Does contain special (escaped) characters?
If it is a POST ā¦ can you show us the body too?
Can you share also the .har file generated by the request?
It is a POST, it does have escaped characters, and the body looks like below. (it is a constructed message in multiple layers, hence the various escapes)
Sending this exact message through to the endpoint using the Object Repository results in a 200.
But calling the endpoint from the test using WS returns the 400
carefully check the content of this variable.
the ānā in the error response may indicate you have somewhere an undesired ānot new line characterā (not properly escaped)
how is this variable produced? it is grabbed by a previous request or created in the script?
LE: to produce reliable Json bodies from the script code, a better approach is to use groovy SimpleTemplateEngine, instead of abusing escapeās (if parametrization is desired)
The content of the message is posted above. It does not vary.
If we had extra escape characters in there, or the json was not properly formatted, would it not fail with both versions?
it may not.
as far as i know there were various updates with regards how the escaping is working (in urlās, in bodies) during various versions ā¦ so better use proper and easy readable ways to produce your bodies.
will help you to reduce flakiness
thatās why I always ask for properly formatted code from the author source.
once pasted as regular text or quote-block, > 50 % of the original code format is destroyed.
and you copy from the forum and paste again somewhere > another source for errors. and so on ā¦