diff --git a/lib/bindings/http-binding.ts b/lib/bindings/http-binding.ts index 4acd886..3ebf3d8 100644 --- a/lib/bindings/http-binding.ts +++ b/lib/bindings/http-binding.ts @@ -96,6 +96,7 @@ function createHttpRequest(data: Partial = {}): HttpRequest { } throw new Error('multipart/form-data support not yet implemented'); }, + ...data.params, } } diff --git a/test/http-binding.spec.ts b/test/http-binding.spec.ts index 3ea0521..2c07743 100644 --- a/test/http-binding.spec.ts +++ b/test/http-binding.spec.ts @@ -43,4 +43,19 @@ describe('http-binding', () => { const result = await functionRunner(functionStub, [{ name: 'myResponse', type: 'http', direction: 'out' }]); expect(result).to.have.property('res', response); }); + it('executes an Http Trigger with params', async () => { + const req = { params: { id: 'testId' } }; + const functionStub = stub().resolves(); + const httpBinding = new HttpBinding(req); + const result = await functionRunner( + functionStub, + [ + { name: 'req', type: 'httpTrigger', direction: 'in' }, + ], + { req: httpBinding }, + ); + expect(functionStub).to.have.been.calledOnceWithExactly(match.any, httpBinding.toContextBinding()); + expect(result.bindingData.params.id).to.equal('testId') + expect(result.bindingData.params).to.deep.equal(req.params) + }); });