Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet authored Aug 25, 2021
1 parent 12c4231 commit ada8b75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions abstractions/dotnet/src/RequestInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@ public class RequestInfo
/// <param name="currentPath">the current path (scheme, host, port, path, query parameters) of the request.</param>
/// <param name="pathSegment">the segment to append to the current path.</param>
/// <param name="isRawUrl">whether the path segment is a raw url. When true, the segment is not happened and the current path is parsed for query parameters.</param>
public void SetURI(string currentPath, string pathSegment, bool isRawUrl) {
if (isRawUrl) {
/// <exception cref="UriFormatException">Thrown when the built URI is an invalid format.</exception>
public void SetURI(string currentPath, string pathSegment, bool isRawUrl)
{
if (isRawUrl)
{
if(string.IsNullOrEmpty(currentPath))
throw new ArgumentNullException(nameof(currentPath));
var parseUri = new Uri(currentPath);
foreach(var qsp in parseUri.Query.Split('&').Select(x => x.Split('=')).Where(x => !string.IsNullOrEmpty(x[0]))) {
QueryParameters.Add(qsp[0], qsp.Length > 1 ? qsp[1] : null);
}
URI = new Uri(parseUri.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped));
} else {
}
else
{
URI = new Uri(currentPath + pathSegment);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Kiota.Builder/CodeParameterOrderComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ private static int getKindOrderHint(CodeParameterKind kind) {
CodeParameterKind.ResponseHandler => 7,
CodeParameterKind.Serializer => 8,
CodeParameterKind.BackingStore => 9,
CodeParameterKind.Custom => 12,
CodeParameterKind.RequestBody => 11,
CodeParameterKind.SetterValue => 10,
CodeParameterKind.RequestBody => 11,
CodeParameterKind.Custom => 12,
_ => 13,
};
}
Expand Down

0 comments on commit ada8b75

Please sign in to comment.