mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Merge pull request #1058 from xhh/str-response-offset
Fix bug with truncated lone string responses for Android/Scala clients
This commit is contained in:
commit
f27eb7e0de
@ -216,7 +216,7 @@ public class ApiInvoker {
|
||||
}
|
||||
else if(String.class.equals(cls)) {
|
||||
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
|
||||
return json.substring(1, json.length() - 2);
|
||||
return json.substring(1, json.length() - 1);
|
||||
else
|
||||
return json;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
|
||||
if (cls == classOf[String]) {
|
||||
json match {
|
||||
case s: String => {
|
||||
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
|
||||
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 1)
|
||||
else s
|
||||
}
|
||||
case _ => null
|
||||
|
@ -216,7 +216,7 @@ public class ApiInvoker {
|
||||
}
|
||||
else if(String.class.equals(cls)) {
|
||||
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
|
||||
return json.substring(1, json.length() - 2);
|
||||
return json.substring(1, json.length() - 1);
|
||||
else
|
||||
return json;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
|
||||
if (cls == classOf[String]) {
|
||||
json match {
|
||||
case s: String => {
|
||||
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
|
||||
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 1)
|
||||
else s
|
||||
}
|
||||
case _ => null
|
||||
|
Loading…
Reference in New Issue
Block a user