'How to send multiple response using nock if there is no request body

I am calling a streaming api http://dummy-streaming-api/customer-details which accepts post requests and sends some data. It does not require any request body. I want to mock the response using nock in a Node.js application for unit tests. I already have a test case for happy journey in which nock intercepts the request and sends 200 along with some data.

nock('http://dummy-streaming-api')
    .persist()
    .get('/customer-details')
    .reply(200,dummyResponse)

How do I write a nock which sends 500 or 404, as I do not have request body to differentiate between 2 requests.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source