Complete the code to create a mock server in Postman.
pm.mockServer.create([1]: 'My Mock Server'});
The name property is required to create a mock server in Postman.
Complete the code to define a mock response for a GET request.
pm.mockServer.addMockResponse({ method: 'GET', [1]: '/users', response: { status: 200, body: '{}' } });The path property defines the endpoint path for the mock response.
Fix the error in the mock response code to enable parallel development.
pm.mockServer.addMockResponse({ method: 'POST', path: '/login', response: { status: 200, body: [1] } });The body must be a JSON string, so it needs to be properly quoted and escaped.
Fill both blanks to create a mock server and add a mock response for GET /products.
const mockServer = pm.mockServer.[1]([2]: 'Product Mock Server'}); mockServer.addMockResponse({ method: 'GET', path: '/products', response: { status: 200, body: '{}' } });
Use create to make the mock server and set its name.
Fill all three blanks to define a mock response with status 404 and a JSON error message.
mockServer.addMockResponse({ method: [1], path: [2], response: { status: [3], body: '{"error": "Not Found"}' } });The mock response uses method 'GET', path '/unknown', and status 404 to simulate a not found error.
