-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to set up custom media type formatters for serializ…
…ation when making request.
- Loading branch information
1 parent
1d035e0
commit 461fc5b
Showing
11 changed files
with
86 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
219 changes: 0 additions & 219 deletions
219
James.Testing.Rest.IntegrationTests/RequestTests/GetTests.cs.orig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Net.Http.Formatting; | ||
|
||
namespace James.Testing.Rest | ||
{ | ||
internal class GetRequest<TResponse, TError> : RequestBase<TResponse, TError> | ||
{ | ||
public GetRequest(string uriString, object headers, DynamicDictionary query) | ||
private readonly MediaTypeFormatter _formatter; | ||
|
||
public GetRequest(string uriString, object headers, DynamicDictionary query, MediaTypeFormatter formatter) | ||
: base(uriString, headers, query) | ||
{} | ||
{ | ||
_formatter = formatter; | ||
} | ||
|
||
protected override IResponse<TResponse, TError> GetResponse(Uri uri, HttpClient client) | ||
{ | ||
var response = client.GetAsync(uri.PathAndQuery).Result; | ||
return new Response<TResponse, TError>(response); | ||
return new Response<TResponse, TError>(response, _formatter); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.