Saloed / JsonFormatter

Repository for study project
GNU General Public License v3.0
0 stars 0 forks source link

Fix resource field in error message #15

Closed SemenMartynov closed 6 years ago

SemenMartynov commented 6 years ago

Expected:

{
 "errorCode"  : 12345,
 "errorMessage" : ["verbose, plain language description of the problem with hints about how to fix it]",
 "errorPlace" : ["highlight the point where error has occurred"],
 "resource"   : ["filename"],
 "request-id" : ["the request id generated by the API for easier tracking of errors"],
}

Received:

$ curl -s --data-binary @bad.json http://localhost                                 
{
  "errorCode": 836099829,
  "errorMessage": " Unterminated array",
  "errorPlace": "line 59 column 28",
  "resource": "json string",
  "request-id": 0
}
$ curl --upload-file bad.json http://localhost                                     
{
  "errorCode": 836099829,
  "errorMessage": " Unterminated array",
  "errorPlace": "line 59 column 28",
  "resource": "json string",
  "request-id": 1
}