Skip to content

Request handler invokes 2 times #91

@kos811

Description

@kos811

Hi!

When i tried to use this library, i found some intresting issue: when i call a handler, it invokes twice.
This problem reproduces when i make a call with Fiddler, Postman or by Opera browser.

Sources of test:


using System;
using System.Threading;
using HttpMock;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var delaySeconds = TimeSpan.FromSeconds(2);
            var serverAddr = "http://localhost:9191";
            var apiPath = "/profileImporter/invoke";
            var url = serverAddr + apiPath;
            Console.WriteLine($"{nameof(url)} : {url}");

            var mockApi = HttpMockRepository.At(serverAddr);
            mockApi.Stub(x => x.Get("")).Return(() =>
            {
                Console.WriteLine($"{DateTime.Now:yyyyMMdd HH:mm:ss} - server called");
                Console.WriteLine($"Delay: {delaySeconds}");
                Thread.Sleep(delaySeconds);
                Console.WriteLine($"{DateTime.Now:yyyyMMdd HH:mm:ss} - delay ended");
                Console.WriteLine();
                Console.WriteLine();
                return "TEST_GET_RESULT";
            }).OK();

            Console.WriteLine("Press any key to exit this shit...");
            Console.ReadKey();
        }
        
    }
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions