javascript - Chai PUT JSON Array -
i make put request report resource using chai.request. in general ressource asks array, here simplified form put request should looks like(problem array [...])
[ { "type": "report", "operator": "string", } ] the problem seems can not make put request chai sending json-array ressource. have equivalent .json file
"reportone": [ { "type": "mainreport", "operator": "plus", } ] but when sending array ressource tells me exception "format exception".
the strange thing case when send same array "swagger" manually there no problem!
it seems can not send using chai.request. tried several things without success. change content-type or create array manually did not solve problem.
here whole request:
try { response = await chai.request(address) .put(apipath + '/report/') .set('authorization', accesstoken) .set('content-type', 'application/json') .set('accept', 'application/json') .send(reportone); } catch (error) { response = error.response; handleerror('error: ', response); }
Comments
Post a Comment