Calling different callbacks for stub on firstcall and second call
<p>I'm looking for a way in sinon to call different functions in first and second call to the stub method.</p>
<p>Here is an example:</p>
<pre class="lang-js prettyprint-override"><code>var func1 = function(connectionPolicy, requestOptions, callback) {
  callback({code: 403});
}

var func2 = function(connectionPolicy, requestOptions, callback) {
  callback(undefined);
}

var stub = sinon.stub();

// Something of this form
stub.onCall(0) = func1;
stub.onCall(1) = func2;

request.createRequestObjectStub = stub;
</code></pre>
<p>So that when <code>request.createrequestObjectStub</code> gets called internally(when calling a public API), I see this behavior.</p>
<ul>
<li>Sinon version: 1.17.4</li>
<li>Environment: Node JS</li>
</ul>