-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a099ebc
commit 5dbeb3f
Showing
4 changed files
with
78 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,14 +22,15 @@ namespace MyNamespace | |
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] | ||
public partial class Client | ||
{ | ||
private string _baseUrl = ""; | ||
private string _baseUrl; | ||
private System.Net.Http.HttpClient _httpClient; | ||
private static System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(CreateSerializerSettings, true); | ||
|
||
public Client(string baseUrl, System.Net.Http.HttpClient httpClient) | ||
{ | ||
BaseUrl = baseUrl; | ||
_httpClient = httpClient; | ||
BaseUrl = ""; | ||
This comment has been minimized.
Sorry, something went wrong.
MaximeMorin-Devolutions
|
||
} | ||
|
||
private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() | ||
|
@@ -42,7 +43,12 @@ namespace MyNamespace | |
public string BaseUrl | ||
{ | ||
get { return _baseUrl; } | ||
set { _baseUrl = value; } | ||
set | ||
{ | ||
_baseUrl = value; | ||
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/")) | ||
baseUrl += '/'; | ||
} | ||
} | ||
|
||
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } | ||
|
@@ -64,7 +70,8 @@ namespace MyNamespace | |
public virtual async System.Threading.Tasks.Task<string> GetAsync(System.Threading.CancellationToken cancellationToken) | ||
{ | ||
var urlBuilder_ = new System.Text.StringBuilder(); | ||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/"); | ||
if (!string.IsNullOrEmpty(BaseUrl)) urlBuilder_.Append(BaseUrl); | ||
urlBuilder_.Append(""); | ||
|
||
var client_ = _httpClient; | ||
var disposeClient_ = false; | ||
|
@@ -142,7 +149,8 @@ namespace MyNamespace | |
throw new System.ArgumentNullException("b"); | ||
|
||
var urlBuilder_ = new System.Text.StringBuilder(); | ||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/sum/{a}/{b}"); | ||
if (!string.IsNullOrEmpty(BaseUrl)) urlBuilder_.Append(BaseUrl); | ||
urlBuilder_.Append("sum/{a}/{b}"); | ||
urlBuilder_.Replace("{a}", System.Uri.EscapeDataString(ConvertToString(a, System.Globalization.CultureInfo.InvariantCulture))); | ||
urlBuilder_.Replace("{b}", System.Uri.EscapeDataString(ConvertToString(b, System.Globalization.CultureInfo.InvariantCulture))); | ||
|
||
|
@@ -311,14 +319,15 @@ namespace MyNamespace | |
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] | ||
public partial class ExampleClient | ||
{ | ||
private string _baseUrl = ""; | ||
private string _baseUrl; | ||
private System.Net.Http.HttpClient _httpClient; | ||
private static System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(CreateSerializerSettings, true); | ||
|
||
public ExampleClient(string baseUrl, System.Net.Http.HttpClient httpClient) | ||
{ | ||
BaseUrl = baseUrl; | ||
_httpClient = httpClient; | ||
BaseUrl = ""; | ||
} | ||
|
||
private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() | ||
|
@@ -331,7 +340,12 @@ namespace MyNamespace | |
public string BaseUrl | ||
{ | ||
get { return _baseUrl; } | ||
set { _baseUrl = value; } | ||
set | ||
{ | ||
_baseUrl = value; | ||
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/")) | ||
baseUrl += '/'; | ||
} | ||
} | ||
|
||
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } | ||
|
@@ -353,7 +367,8 @@ namespace MyNamespace | |
public virtual async System.Threading.Tasks.Task<FileResponse> GetAsync(System.Threading.CancellationToken cancellationToken) | ||
{ | ||
var urlBuilder_ = new System.Text.StringBuilder(); | ||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/examples"); | ||
if (!string.IsNullOrEmpty(BaseUrl)) urlBuilder_.Append(BaseUrl); | ||
urlBuilder_.Append("examples"); | ||
|
||
var client_ = _httpClient; | ||
var disposeClient_ = false; | ||
|
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
@paulomorgado When I generated and tested,
baseUrl
did not exists here. Did you mean_baseUrl
? If so, there were a couple of places, where I had to make the change.