https://kotlinlang.org logo
Title
c

christophsturm

04/20/2020, 4:35 PM
if i send a post request like this:
<http://client.post|client.post><String>("....") {
                body = TextContent(stringBody, ContentType.Application.FormUrlEncoded)
            }
does it set a content type header? if I test the code with the MockEngine it has no content type header set.
r

rscorer

04/20/2020, 5:02 PM
Yes it does 🙂 My code here
<http://client.post|client.post><String>("<http://ptsv2.com/t/v50jm-1587401898/post>") {
    body = TextContent(stringBody, ContentType.Application.FormUrlEncoded)
}
pinged http://ptsv2.com/ and left a content type header - you can see the "dump" here http://ptsv2.com/t/v50jm-1587401898/d/434892983
Details
Posted: 2020-04-20 16:59:32 UTC
Method: POST
Source: 92.12.82.154
Headers
Header	Values
Accept	application/json
Accept-Charset	UTF-8
Content-Length	0
Content-Type	application/x-www-form-urlencoded
Host	<http://ptsv2.com|ptsv2.com>
User-Agent	Ktor client
X-Cloud-Trace-Context	72685444afe1409922ec95a20d57850d/333355599654072383
X-Google-Apps-Metadata	domain=<http://gmail.com|gmail.com>,host=<http://ptsv2.com|ptsv2.com>
c

christophsturm

04/20/2020, 5:34 PM
interesting. then its probably a bug in the MockEngine
ok its probably related to this: https://github.com/ktorio/ktor/pull/1169
r

rscorer

04/20/2020, 7:20 PM
Interesting. I didn’t look at the mock engine just the external receiver. Cheers