Httpchk POST adding "Connection: close" after data

I have setup haproxy 1.7.8 with option httpchk for my backend servers and have working GET requests.
But while configuring the POST request with json data, I am getting error code 400.

Here is my check added in backend block,

option httpchk POST /myService/endpt HTTP/1.1\r\nContent-Type:\ application/json;charset=UTF-8\r\nContent-Length:\ 169\r\n\r\n{\"inputs\":[{\"id\":1,\"productType\":\"productType\",\"productDescription\":\"productDescription\",\"metaDescription\":\"metaDescription\",\"metaTitle\":\"metaTitle\",\"rawxyz\":\"rawxyz\"}]}
http-check expect rstatus (2|3)[0-9][0-9]

After debugging with wireshark capture I came to know that, haproxy is adding \r\f"Connection: close"\r\f\r\f at the end of the post json data.
From this manual, https://www.haproxy.org/download/1.7/doc/configuration.txt, I found that haproxy appends it if httpchk is combined with http-check expect.
But it should be added to header fields and not after data.

This is causing packet parse failure, as it considering POST data as a part of header and reporting extra CRLF in headers.

I would need the http-check expect block to verify error code, but then how would I avoid adding Connection: close at the end.
I tried adding it as part of header itself, but it still appends one of its own.
Is it a bug? I can’t find it in known bugs list.

It was certainly a conscious decision to disable keep-alive:
http://git.haproxy.org/?p=haproxy-1.7.git;a=commitdiff;h=32602d23610981b48143d1f82885b8cfae286e0f

Obviously the way the code adds this header does not work for a HTTP request with a body, like HTTP POST request.

You can certainly just remove those 3 lines in src/checks.c by hand, this will stop the issue.

As for a proper solution this needs to be discussed on the mailing list. If you can send request to the mailing list, please CC Willy and Cyril (author and committer) and include the link I to the commit I posted above.

Thanks @lukastribus,
I will send it to haproxy@formilux.org