You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I set the content type to x-application/hl7-v2+er7; charset=utf-8 for a POST request, the request body is empty. In the appendix you will find an example project to simulate the behavior.
In the example there are two scenarios, one with content-type x-application/hl7-v2+er7; charset=utf-8 and one with content-type application/plain; charset=utf-8. The request body is in both scenrios the same.
* url 'https://httpbin.org'
* def message = "MSH|^~\&|ADT1|GOOD HEALTH HOSPITAL|GHH LAB, INC.|GOOD HEALTH HOSPITAL|198808181126|SECURITY|ADT^A01^ADT_A01|MSG00001|P|2.8||"
Given path 'post'
And header Content-Type = 'x-application/hl7-v2+er7; charset=utf-8'
And request message
When method post
Then status 200
log entry with missing body (Content-Type: x-application/hl7-v2+er7; charset=utf-8)
@andreas-hempel appreciate the details and the info to replicate. actually, when logging the request, karate does not attempt to log the body if it is some "unknown" type, and the reason for this is to avoid logging binary content. so that explains that part
so look at the response from httpbin.org you will see that the request string was indeed sent and received successfully on the server:
we could probably introduce a new configuration setting to over-ride the request (or response) body logging suppression, so I can leave this issue open for now.
just one tip - in case you have weird content that confuses the JSON parser or spans multiple lines, you can consider using text. it won't solve your original problem, but may be useful:
* text body =
""" MSH|^~\&|ADT1|GOOD HEALTH HOSPITAL|GHH LAB, INC.|GOOD HEALTH HOSPITAL|198808181126|SECURITY|ADT^A01^ADT_A01|MSG00001|P|2.8|| """* url 'https://httpbin.org/post'* header Content-Type = 'x-application/hl7-v2+er7'* request body
* method post
can you confirm that the HTTP call works fine at least from the server pov ? if your intent is to have the body show up in the HTML report somehow, you could always do * print body
Hello KarateDSL team,
I am using KarateDSL to check if an HL7 message processing is executed correctly and the data is rendered correctly via a second FHIR endpoint (REST based). When sending the message, the content-type x-application/hl7-v2+er7 must be used (see https://hapifhir.github.io/hapi-hl7v2/hapi-hl7overhttp/specification.html#a2.4_Content_Type_and_Character_Set)
If I set the content type to x-application/hl7-v2+er7; charset=utf-8 for a POST request, the request body is empty. In the appendix you will find an example project to simulate the behavior.
missing-body.zip
In the example there are two scenarios, one with content-type x-application/hl7-v2+er7; charset=utf-8 and one with content-type application/plain; charset=utf-8. The request body is in both scenrios the same.
log entry with missing body (Content-Type: x-application/hl7-v2+er7; charset=utf-8)
log entry with body (Content-Type: text/plain; charset=utf-8)
I've tested everything in a new minimal maven karate template as explained in https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue, and you can replicate everything in the code in the attached .zip using the command:
mvn clean test
Many thanks and best regards,
Andreas
The text was updated successfully, but these errors were encountered: