Complete the code to set the HTTP method to PATCH in Postman.
pm.request.method = '[1]';
The HTTP method must be set to PATCH to update part of a resource.
Complete the code to add a JSON body with a field 'status' set to 'active' for the PATCH request.
pm.request.body.raw = JSON.stringify({"status": [1] });The JSON body must have the field status set to the string "active" with double quotes inside the JSON string.
Fix the error in the test script to check if the PATCH response status code is 200.
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
The status code must be a number 200, not a string, for the assertion to work correctly.
Fill both blanks to set the Content-Type header to application/json for the PATCH request.
pm.request.headers.add({ key: [1], value: [2] });The header key must be "Content-Type" and the value must be "application/json" to indicate JSON data.
Fill all three blanks to write a test that checks the PATCH response JSON has a 'status' field equal to 'active'.
pm.test('Response status is active', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.eql([2]); pm.expect(pm.response.code).to.equal([3]); });
The test checks the JSON field status equals the string "active" and the response code is 200.