Browse Source

* Do not call parsing if JSON is empty (e.g. return 204 with empty body)

Michaël Van Canneyt 8 months ago
parent
commit
8d24a28c56
1 changed files with 4 additions and 0 deletions
  1. 4 0
      packages/fcl-jsonschema/src/fpjson.schema.codegen.pp

+ 4 - 0
packages/fcl-jsonschema/src/fpjson.schema.codegen.pp

@@ -742,6 +742,10 @@ begin
   Addln('begin');
   indent;
   Addln('Result := Default(%s);', [aType.PascalName]);
+  Addln('if (aJSON='''') then');
+  indent;
+  Addln('exit;');
+  undent;
   if DelphiCode then
     Addln('lObj := TJSONObject.ParseJSONValue(aJSON,True,True) as TJSONObject;')
   else