returnres.status(400).send(JSON.stringify({success: false,message:'Other users have also saved this image so it cannot be modified. You will have to replace your own references.'}));
returnres.status(400).send({success: false,message:'Other users have also saved this image so it cannot be modified. You will have to replace your own references.'});
message:"Got error processing image delete. See server logs at "+errorTime+" Error Details: "+error
message:"Got error processing image delete. See server logs at "+errorTime+" Error Details: "+JSON.stringify(error)
});
}
});
@ -428,7 +428,7 @@ async function retrievelimits(req, res) {
console.error("Got bad response of",response.status,"when checking rate limits for",issuerDid);
return{
success: false,
result: res.status(400).send(JSON.stringify({success: false,message:'Got bad status of '+response.status+' when checking limits with endorser server. Verify that the account exists and that the JWT works for that server.'}))
result: res.status(400).send({success: false,message:'Got bad status of '+response.status+' when checking limits with endorser server. Verify that the account exists and that the JWT works for that server.'})
};
}else{
constbody=awaitresponse.json();
@ -453,7 +453,7 @@ async function retrievelimits(req, res) {
if(maxImagesPerWeek==null){
return{
success: false,
result: res.status(400).send(JSON.stringify({success: false,message:'Unable to determine rate limits for this user. Verify that the account exists and that the JWT works for that server.'}))
result: res.status(400).send({success: false,message:'Unable to determine rate limits for this user. Verify that the account exists and that the JWT works for that server.'})
};
}
@ -497,7 +497,7 @@ async function decodeJwt(req, res) {
if(!auth||!auth.startsWith('Bearer ')){
return{
success: false,
result: res.status(401).send(JSON.stringify({success: false,message:'Missing "Bearer JWT" in Authorization header.'}))
result: res.status(401).send({success: false,message:'Missing "Bearer JWT" in Authorization header.'})
};
}
constjwt=auth.substring('Bearer '.length);
@ -507,7 +507,7 @@ async function decodeJwt(req, res) {
console.error(errorTime,'Got invalid JWT in Authorization header:',verified);
return{
success: false,
result: res.status(401).send(JSON.stringify({success: false,message:'Got invalid JWT in Authorization header. See server logs at '+errorTime}))
result: res.status(401).send({success: false,message:'Got invalid JWT in Authorization header. See server logs at '+errorTime})
RESULT=$(curl -X POST -H "Authorization: Bearer $JWT" -F "image=@test2.svg""$HOST/image")
echo curl result: $RESULT
SUCCESS=$(echo$RESULT| jq -r '.success')
if[$SUCCESS="true"];then
echo"User #2 uploaded SVG file."
else
echo"User #2 failed to upload SVG file. Note that this may be because the server wasn't started with NODE_ENV=test-local which bypasses check of the exp date.";