Пример #1
0
        public static async Task <HttpResponseMessage> PutByIdAsync <TPrimaryKey>(
            this HttpClient client,
            string path,
            ITestOutputHelper output,
            TPrimaryKey id,
            IDto dto
            )
        {
            var builder = BuildPathWithEntity(client, path, id);

            output.WriteLine($"METHOD PUT, url:'{builder.Uri.PathAndQuery}' dto:'{dto.ToJson()}'");
            return(await WriteApiErrorAsync(await client.PutAsync(builder.Uri.PathAndQuery, dto.ToStringContent()), output));
        }
Пример #2
0
        public static async Task <HttpResponseMessage> PostAsync(
            this HttpClient client,
            string path,
            ITestOutputHelper output,
            IDto dto
            )
        {
            var builder = BuildPath(client, path);

            output.WriteLine($"METHOD POST, url:'{builder.Uri.PathAndQuery}' dto:'{dto.ToJson()}'");
            return(await WriteApiErrorAsync(await client.PostAsync(builder.Uri.PathAndQuery, dto.ToStringContent()), output));
        }