static Task Verify(FakeHttpRequest request)
    {
        var extract = RequestParser.Extract(request, CancellationToken.None).GetAwaiter().GetResult();

        return(Verifier.Verify(new
        {
            extract.Attachments.Single().FileName,
            extract.Body,
            extract.ClientUrl,
            extract.Destination,
            extract.Id,
            extract.Type
        }));
    }
예제 #2
0
    public async Task Send(HttpContext context, CancellationToken cancellation = default)
    {
        var passThroughMessage = await RequestParser.Extract(context.Request, cancellation);

        var destinationTable = await sendCallback(context, passThroughMessage).ConfigureAwait(true);

        ProcessClaims(context, passThroughMessage);
        var rowVersion = await sender.Send(passThroughMessage, destinationTable, cancellation).ConfigureAwait(true);

        var wasDedup = rowVersion == 0;

        if (wasDedup)
        {
            logger.LogInformation("Dedup detected. Setting response to HttpStatusCode.Conflict (409). Id:{id}", passThroughMessage.Id);
            // 208 already reported
            context.Response.StatusCode = 208;
            return;
        }
        context.Response.StatusCode = StatusCodes.Status202Accepted;
    }