Skip to content

Commit

Permalink
chore: fix compatibility issues in compatibility verification (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcent authored Mar 31, 2024
1 parent 6b8b0ae commit abcaae1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.itangcent.idea.plugin.api.export.condition.ConditionOnSimple
import com.itangcent.idea.plugin.api.export.core.*
import com.itangcent.idea.plugin.api.export.spring.SpringRequestClassExporter
import com.itangcent.idea.plugin.condition.ConditionOnSetting
import org.apache.commons.lang.StringUtils.lowerCase

/**
* Support export apis from client that annotated with @FeignClient
Expand Down Expand Up @@ -104,7 +103,7 @@ open class FeignRequestClassExporter : SpringRequestClassExporter() {
val name = it.first
val value = it.second.trim()
if (name.equalIgnoreCase("content-type")) {
if (lowerCase(value).contains("application/json")) {
if (value.lowercase().contains("application/json")) {
methodExportContext.setExt("paramType", "body")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import com.intellij.util.io.createDirectories
import com.intellij.util.io.readText
import com.itangcent.intellij.context.ActionContext
import java.io.IOException
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.io.path.readText
import kotlin.io.path.writeText

/**
Expand Down Expand Up @@ -67,7 +69,7 @@ class HttpClientFileSaver {
val file = scratchesPath.resolve(module).resolve(fileName).apply {
parent.createDirectories()
}
file.writeText(content(file.takeIf { Files.exists(it) }?.readText()))
file.writeText(content(file.takeIf { Files.exists(it) }?.readText(StandardCharsets.UTF_8)))

return (localFileSystem.refreshAndFindFileByPath(file.toString())
?: throw IOException("Unable to find file: $file"))
Expand Down

0 comments on commit abcaae1

Please sign in to comment.