Skip to content

Request body empty when use Content-Type x-application/hl7-v2+er7 #2626

@andreas-hempel

Description

@andreas-hempel

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.

* 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)

15:24:25.410 [pool-2-thread-1] DEBUG com.intuit.karate - request:
1 > POST https://httpbin.org/post
1 > Content-Type: x-application/hl7-v2+er7; charset=utf-8
1 > Content-Length: 123
1 > Host: httpbin.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8.1)
1 > Accept-Encoding: gzip,deflate

log entry with body (Content-Type: text/plain; charset=utf-8)

15:24:25.410 [pool-2-thread-2] DEBUG com.intuit.karate - request:
1 > POST https://httpbin.org/post
1 > Content-Type: text/plain; charset=utf-8
1 > Content-Length: 123
1 > Host: httpbin.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8.1)
1 > Accept-Encoding: gzip,deflate
MSH|^~&|ADT1|GOOD HEALTH HOSPITAL|GHH LAB, INC.|GOOD HEALTH HOSPITAL|198808181126|SECURITY|ADT^A01^ADT_A01|MSG00001|P|2.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions