File tree Expand file tree Collapse file tree
plugin-apipost/src/main/kotlin/me/leon/toolsfx/plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,12 +153,16 @@ class ApiPostView : PluginFragment("ApiPost") {
153153 }
154154 val curlFiles = ApiConfig .curlDir.toFile().listFiles()?.map { it.nameWithoutExtension }
155155 if (curlFiles != null && curlFiles.isNotEmpty()) {
156- selectedUrl.set(curlFiles.first())
157- combobox(selectedUrl, curlFiles.toMutableList()) { cellFormat { text = it } }
156+ val newCurlFiles = curlFiles.toMutableList()
157+ newCurlFiles.add(0 , " " )
158+ selectedUrl.set(" " )
159+ combobox(selectedUrl, newCurlFiles) { cellFormat { text = it } }
158160 selectedUrl.addListener { _, _, newValue ->
159- println (" selectedUrl $newValue " )
161+ if (newValue.isEmpty()) {
162+ resetUi(" https://httpbin.org/anything" )
163+ return @addListener
164+ }
160165 tfUrl.text = newValue as String
161- println (" selectedUrl2 ${tfUrl.text} " )
162166 val curl = File (ApiConfig .curlDir.toFile(), " $newValue .curl" )
163167 resetUi(curl.readText())
164168 }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ data class Response(
1111 val statusInfo: String
1212 get() =
1313 " ${headers[null ]} Time : $time ms " +
14- " Size : ${headers[" Content-Length" ] ? : headers[" content-length" ] ? : " unknown" } Bytes"
14+ " Size : ${headers[" Content-Length" ] ? : headers[" content-length" ] ? : " unknown" } Bytes"
1515
1616 val length: Int
1717 get() = " ${headers[" Content-Length" ] ? : headers[" content-length" ] ? : " -1" } " .toInt()
You can’t perform that action at this time.
0 commit comments