-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a first class HttpBinding + binding data support #568
Conversation
"type": "blob", | ||
"name": "outBlob", | ||
"direction": "out", | ||
"path": "samples-output/{Id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't work before. Now you can bind to values from the payload.
Dictionary<string, object> bindingData = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); | ||
if (request.Content != null && request.Content.Headers.ContentLength > 0) | ||
{ | ||
string body = request.Content.ReadAsStringAsync().Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this method async
(the caller is an async
method as well) and await
here to avoid .Result
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Took a quick first pass at this. Feels good to see this landing! :) |
7e4e1c3
to
67f54a7
Compare
Merged. I'll address any additional feedback anyone has. |
These changes are being made to address the following bugs:
#334 HttpTrigger: Request object needs to be part of bindingdata
#230 C#: Extract binding data for HttpTrigger
Currently for C# there is no binding data support for HttpTrigger, meaning you can't use binding expressions in your output bindings that reference data from the request. We were able to work around this limitation in Node (and the other script languages) because bindings for those languages are late bound meaning we can inject the binding data before the bind happens. For C# we can't, since binding contract validation is done when the function method is loaded into the host (same as in core SDK scenarios).
To address this, I'm introducing a minimal HttpTrigger binding. The behavior is:
Languages other than C# should continue to work the way they do now, except that they'll also now have the ability to bind to query string parameters (when no body is sent).
I'm not planning on checking this in until AFTER iteration 20 is complete.