Skip to content

Commit 26cb046

Browse files
committed
Resetting content stream so functions can properly read it.
1 parent 2ea7541 commit 26cb046

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/WebJobs.Script.WebHost/Controllers/FunctionsController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using System.IO;
56
using System.Linq;
67
using System.Net;
78
using System.Net.Http;
@@ -70,6 +71,10 @@ public override async Task<HttpResponseMessage> ExecuteAsync(HttpControllerConte
7071
// then invoke this callback.
7172
Func<HttpRequestMessage, Task<HttpResponseMessage>> invokeFunction = async (req) =>
7273
{
74+
// Reset the content stream before passing the request down to the function
75+
Stream stream = await req.Content.ReadAsStreamAsync();
76+
stream.Seek(0, SeekOrigin.Begin);
77+
7378
return await _scriptHostManager.HandleRequestAsync(function, req, cancellationToken);
7479
};
7580
response = await _webHookReceiverManager.HandleRequestAsync(function, request, invokeFunction);

0 commit comments

Comments
 (0)