A student was given this JSON protocol specification: Reques…
A student was given this JSON protocol specification: Request: { “type”: “add”, “numbers”: [1, 2, 3] } Success Response: { “ok”: true, “sum”: 6 } Error Responses: – Empty array: { “ok”: false, “error”: “numbers array cannot be empty” } – Missing field: { “ok”: false, “error”: “numbers field is required” } – Invalid type: { “ok”: false, “error”: “numbers must be an array” } A server was implemented, we send two requests and got the following responses: Request 1: { “type”: “add”, “numbers”: [5, 10] } Response 1: { “success”: true, “result”: “15” } Request 2: { “type”: “add”, “numbers”: [] } Response 2: { “ok”: false, “sum”: 0, “error”: “numbers field is required” } 1. List all protocol violations across both responses. 2. Write out how the responses should look like.
Read Details