POST
Post requests can be made only via kotlin dsl. For post calls kohttp will set content type by rule that mentioned below.
Content type priority
Content type is set according to the following priority levels (higher is prioritized)
Form or Json in body :
body() { json { ... } } ...
Custom body type :
body(myContentType) { ... } ...
Header :
header { "Content-type" to myContentType } ...
POST with form body.
form
body has a application/x-www-form-urlencoded
content type
POST with json body.
json
body has a application/json
content type
POST with various content type
In addition to form
or json
body content types it is possible to declare a custom content type.
body
DSL support three data sources: file()
, bytes()
and string()
POST with multipart body
Last updated