mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 12:03:19 +00:00
Support requests with HttpContent body
If a 3rd party client needs to provide a specific HttpContent, we should allow that in the adapter. Our clients probably shouldn't do this as it would break encapsulation.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@@ -57,6 +58,23 @@ namespace Octokit.Tests.Http
|
||||
Assert.Equal("text/plain", requestMessage.Content.Headers.ContentType.MediaType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetsHttpContentBody()
|
||||
{
|
||||
var request = new Request
|
||||
{
|
||||
Method = HttpMethod.Post,
|
||||
Body = new FormUrlEncodedContent(new Dictionary<string, string> {{"foo", "bar"}})
|
||||
};
|
||||
var tester = new HttpClientAdapterTester();
|
||||
|
||||
var requestMessage = tester.BuildRequestMessageTester(request);
|
||||
|
||||
Assert.NotNull(requestMessage.Content);
|
||||
Assert.IsType<FormUrlEncodedContent>(requestMessage.Content);
|
||||
Assert.Equal("application/x-www-form-urlencoded", requestMessage.Content.Headers.ContentType.MediaType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnsuresArguments()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user