diff --git a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/extension/UserRequestConversionExtension.kt b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/extension/UserRequestConversionExtension.kt index ac0e30fd..b08a8cd8 100644 --- a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/extension/UserRequestConversionExtension.kt +++ b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/extension/UserRequestConversionExtension.kt @@ -215,7 +215,7 @@ fun HttpRequest.toApacheHttpRequest(): Pair { *(entity.trailers?.get()?.toTypedArray() ?: emptyArray()) ) } - is StringBody -> AsyncEntityProducers.create(body.value) + is StringBody -> AsyncEntityProducers.create(body.value, Charsets.UTF_8) null -> null else -> throw UnsupportedOperationException() } diff --git a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/model/HttpRequest.kt b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/model/HttpRequest.kt index 6531df1f..d81954e6 100644 --- a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/model/HttpRequest.kt +++ b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/model/HttpRequest.kt @@ -14,7 +14,7 @@ data class HttpRequest( val extra: Any? = null ) { fun getResolvedUri(): URI { - return URIBuilder(url) + return URIBuilder(url.replace(" ", "+")) .run { var b = this queryParameters.forEach { @@ -23,5 +23,6 @@ data class HttpRequest( b } .build() + .let { URI.create(it.toASCIIString()) } } } diff --git a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/RequestEditorView.kt b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/RequestEditorView.kt index f17149ac..2b032201 100644 --- a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/RequestEditorView.kt +++ b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/RequestEditorView.kt @@ -138,7 +138,7 @@ fun RequestEditorView( val hasPayloadEditor = (request.application == ProtocolApplication.WebSocket || (request.application == ProtocolApplication.Grpc && currentGrpcMethod?.isClientStreaming == true) ) - var selectedPayloadExampleId by rememberLast(request.id) { mutableStateOf(request.payloadExamples?.firstOrNull()?.id) } + var selectedPayloadExampleId by rememberLast(request.id, request.application) { mutableStateOf(request.payloadExamples?.firstOrNull()?.id) } val isEnableSendButton = when (connectionStatus.isConnectionActive()) { true -> true