[kotlin][spring] Fix ApiUtil compilation (#6084)

This commit is contained in:
sylvainmoindron
2020-06-05 03:29:40 +02:00
committed by GitHub
parent dc9a898e11
commit 388218bdf9
3 changed files with 9 additions and 9 deletions

View File

@@ -9,9 +9,9 @@ object ApiUtil {
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
try {
val res = req.getNativeResponse(HttpServletResponse::class.java)
res.setCharacterEncoding("UTF-8")
res.addHeader("Content-Type", contentType)
res.getWriter().print(example)
res?.characterEncoding = "UTF-8"
res?.addHeader("Content-Type", contentType)
res?.writer?.print(example)
} catch (e: IOException) {
throw RuntimeException(e)
}