Complete the code to set the HTTP method to PUT in Postman.
pm.request.method = '[1]';
The HTTP method must be set to PUT to update resources using a PUT request.
Complete the code to add a JSON body to the PUT request in Postman.
pm.request.body.raw = JSON.stringify({"name": "John", "age": 30});
pm.request.body.mode = '[1]';To send a JSON string as the body, the mode must be set to raw.
Fix the error in the code to set the Content-Type header for a PUT request in Postman.
pm.request.headers.upsert('Content-Type', '[1]');
The Content-Type for JSON data must be application/json to inform the server about the data format.
Fill both blanks to correctly check the PUT response status and parse JSON in Postman test script.
pm.test('Status code is [1]', () => { pm.response.to.have.status([2]); });
The test description should be a string like '200 OK', but the status code check requires the numeric value 200.
Fill all three blanks to write a test that checks the PUT response JSON has a 'success' key set to true.
pm.test('Response has success true', () => { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.eql([2]); pm.expect(typeof jsonData.[3]).to.eql('boolean'); });
The JSON key is 'success' and it should be true. The type check uses the same key.