Skip to content

Commit ee9510d

Browse files
committed
fix wrong content-type header
1 parent 2375287 commit ee9510d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/extension/UserRequestConversionExtension.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ fun UserRequestTemplate.toHttpRequest(
9090
application = application,
9191
)
9292

93+
if (req.headers.none { "content-type".equals(it.first, ignoreCase = true) } && req.contentType.headerValue != null) {
94+
req = req.copy(headers = req.headers + ("Content-Type" to req.contentType.headerValue!!))
95+
}
96+
9397
if (application == ProtocolApplication.Graphql) {
9498
val graphqlBody = req.body as GraphqlBody
9599
val baseGraphqlBody = baseExample.body as GraphqlBody

0 commit comments

Comments
 (0)