Пример #1
0
        public async Task NoContentWithContentTypeHandledCleanly()
        {
            using (MockHttpServer.Raw((request, response) =>
            {
                response.StatusCode = 204;
                response.ContentType = "application/json";
            }))
            {
                var client = HttpApiClient <IPostReturnsNothing> .Create("http://localhost:8844/path");

                await client.Post("foo");
            }
        }
Пример #2
0
        public async Task NonSuccessThrowsException()
        {
            using (MockHttpServer.Raw((request, response) => response.StatusCode = 500))
            {
                var client = HttpApiClient <INonSuccess> .Create("http://localhost:8844");

                try
                {
                    await client.Call();

                    Assert.Fail("An exception should have been thrown");
                }
                catch (NonSuccessfulResponseException)
                {
                }
            }
        }