Skip to content
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

Usage in Azure Functions #98

Open
alastairtree opened this issue Dec 30, 2020 · 0 comments
Open

Usage in Azure Functions #98

alastairtree opened this issue Dec 30, 2020 · 0 comments

Comments

@alastairtree
Copy link

Hi,

Thanks for this library, it is great.

I had a use case for it in Azure Functions where there is no middleware pipeline to hook into, so I used the library and added a small class that emulates the key bits of the middleware from this project but allowing it to be called as a wrapper function on a single HTTP Request in isolation.

You can see the code in this gist and you use it like this:

public MyFunc(HttpCorrelation http)
{
      this.http = http;
}

[FunctionName(nameof("MyFunc"))]
public async Task<IActionResult> Put([HttpTrigger(AuthorizationLevel.Function, "put", Route = "endpoint")]
            HttpRequest req)
{
    return await http.ExecuteFunction(req, async () =>
    {
          // Do stuff ...
         return new AcceptedResult();
    });
}

Just posting it here in case it is of use to anyone or you wanted to adopt a version of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant