Skip to content

Commit

Permalink
fit interface of RequestFactory.Create to Request.Create
Browse files Browse the repository at this point in the history
  • Loading branch information
iwate committed Aug 17, 2023
1 parent 680e9d5 commit ed55bf2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/ODataHttpClient.Tests/RequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void CreateRequestWithHeaderByFactory()
var body = "text";
var request = new RequestFactory()
.Create(HttpMethod.Get, uri,
body, headers, null);
body, headers:headers);
Assert.Equal(HttpMethod.Get, request.Method);
Assert.True(((Request)request).Headers.ContainsKey(headerKey));
}
Expand Down
32 changes: 16 additions & 16 deletions src/ODataHttpClient/Models/RequestFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ public RequestFactory(IJsonSerializer serializer)
{
JsonSerializer = serializer;
}
public Request Create<T>(HttpMethod method, string uri, T body, IEnumerable<KeyValuePair<string, object>> additionals)
=> Request.Create<T>(method, uri, body, additionals, JsonSerializer);
public Request Create<T>(HttpMethod method, string uri, T body, string type = null, string typeKey = Request.DEFAULT_TYPE_KEY)
=> Request.Create<T>(method, uri, body, type, typeKey, JsonSerializer);
public Request Create<T>(HttpMethod method, string uri, T body, IReadOnlyDictionary<string, string> headers, IEnumerable<KeyValuePair<string, object>> additionals)
=> Request.Create<T>(method, uri, body, additionals, JsonSerializer, headers);
public Request Create<T>(HttpMethod method, string uri, T body, IReadOnlyDictionary<string, string> headers, string type = null, string typeKey = Request.DEFAULT_TYPE_KEY)
=> Request.Create<T>(method, uri, body, type, typeKey, JsonSerializer, headers);
public Request Create(HttpMethod method, string uri, bool acceptNotFound = false)
=> Request.Create(method, uri, acceptNotFound);
public Request Create(HttpMethod method, string uri, IReadOnlyDictionary<string, string> headers, bool acceptNotFound = false)
=> Request.Create(method, uri, headers, acceptNotFound);
public Request Create<T>(HttpMethod method, string uri, T body, string type = null, string typeKey = Request.DEFAULT_TYPE_KEY, IReadOnlyDictionary<string, string> headers = null, bool acceptNotFound = false)
=> Request.Create<T>(method, uri, body, type, typeKey, JsonSerializer, headers, acceptNotFound);
public Request Create<T>(HttpMethod method, string uri, T body, IEnumerable<KeyValuePair<string, object>> additionals, IReadOnlyDictionary<string, string> headers = null, bool acceptNotFound = false)
=> Request.Create<T>(method, uri, body, additionals, JsonSerializer, headers, acceptNotFound);

public Request Get(string uri)
=> Request.Get(uri);
public Request Get(string uri, bool acceptNotFound = true)
=> Request.Get(uri, acceptNotFound);

public Request Get(string uri, object @params)
=> Request.Get(uri, @params);
public Request Get(string uri, object @params, bool acceptNotFound = true)
=> Request.Get(uri, @params, acceptNotFound);

public Request Head(string uri)
=> Request.Head(uri);
public Request Head(string uri, bool acceptNotFound = true)
=> Request.Head(uri, acceptNotFound);

public Request Head(string uri, object @params)
=> Request.Head(uri, @params);
public Request Head(string uri, object @params, bool acceptNotFound = true)
=> Request.Head(uri, @params, acceptNotFound);

public Request Delete(string uri)
=> Request.Delete(uri);
Expand Down

0 comments on commit ed55bf2

Please sign in to comment.