Complete the code to set the HTTP method to GET in Postman.
pm.request.method = '[1]';
The HTTP method for retrieving data is GET. Setting pm.request.method = 'GET' configures the request correctly.
Complete the code to check if the response status code is 200.
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
The status code 200 means the request was successful. The test checks if the response status matches 200.
Fix the error in the code to parse JSON response body correctly.
let data = pm.response.json()[1];The pm.response.json() method returns the parsed JSON object. Adding a semicolon ; ends the statement correctly.
Fill both blanks to assert the response body contains a property 'success' with value true.
pm.test('Response has success true', function () { pm.expect(pm.response.json().[1]).to.eql([2]); });
The response JSON should have a property named success with the boolean value true. The test checks this condition.
Fill all three blanks to test that the response header 'Content-Type' includes 'application/json'.
pm.test('Content-Type is JSON', function () { pm.expect(pm.response.headers.get('[1]')).to.include('[2]'); pm.expect(pm.response.headers.has('[3]')).to.be.true; });
The header name is Content-Type (case sensitive in Postman). The test checks that this header exists and includes the string application/json.