GET https://jsonplaceholder.typicode.com/posts/1A GET request to a valid resource typically returns status code 200, meaning success.
{"userId": 1, "id": 1, "title": "...", "body": "..."}Which Postman test script assertion correctly checks that userId equals 1?
Option A correctly parses the JSON response and uses to.eql(1) to assert equality.
Other options either access wrong properties or use invalid assertion methods.
pm.test('Title exists', () => { pm.expect(pm.response.body.title).to.exist; });What causes the error?
pm.test('Title exists', () => { pm.expect(pm.response.body.title).to.exist; });pm.response.body is a raw string, so accessing .title directly causes a TypeError.
Use pm.response.json() to parse the body first.
GET requests are used to fetch data without side effects.
POST requests send data to the server to create or update resources.
Option A uses pm.response.headers.get() which is the correct way to access headers.
It also uses to.include() to check substring presence.
Other options either use wrong access or wrong assertion methods.
