Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix feature/v3 integration with azure-sdk-for-net #1065

Merged
2 commits merged into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ input-file: "swagger-document"

```yaml
# autorest-core version
version: 3.1.0-dev.3
version: 3.0.6371
save-inputs: true
use: $(this-folder)/artifacts/bin/AutoRest.CSharp/Debug/netcoreapp3.0/
clear-output-folder: true
Expand Down
12 changes: 6 additions & 6 deletions src/assets/Generator.Shared/FormUrlEncodedContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ namespace Azure.Core
{
internal class FormUrlEncodedContent : RequestContent
{
private List<KeyValuePair<string?, string?>> _values = new List<KeyValuePair<string?, string?>>();
private List<KeyValuePair<string, string>> _values = new List<KeyValuePair<string, string>>();
private Encoding Latin1 = Encoding.GetEncoding("iso-8859-1");
private byte[] _bytes = new byte[0];
private byte[] _bytes = Array.Empty<byte>();

public void Add (string parameter, string value)
{
_values.Add(new KeyValuePair<string?, string?> (parameter, value));
_values.Add(new KeyValuePair<string, string> (parameter, value));
}

private void BuildIfNeeded ()
Expand Down Expand Up @@ -55,7 +55,7 @@ public override void Dispose()
}

// Taken with love from https://github.com/dotnet/runtime/blob/master/src/libraries/System.Net.Http/src/System/Net/Http/FormUrlEncodedContent.cs#L21-L53
private byte[] GetContentByteArray(IEnumerable<KeyValuePair<string?, string?>> nameValueCollection)
private byte[] GetContentByteArray(IEnumerable<KeyValuePair<string, string>> nameValueCollection)
{
if (nameValueCollection == null)
{
Expand All @@ -64,7 +64,7 @@ private byte[] GetContentByteArray(IEnumerable<KeyValuePair<string?, string?>> n

// Encode and concatenate data
StringBuilder builder = new StringBuilder();
foreach (KeyValuePair<string?, string?> pair in nameValueCollection)
foreach (KeyValuePair<string, string> pair in nameValueCollection)
{
if (builder.Length > 0)
{
Expand All @@ -79,7 +79,7 @@ private byte[] GetContentByteArray(IEnumerable<KeyValuePair<string?, string?>> n
return Latin1.GetBytes(builder.ToString());
}

private static string Encode(string? data)
private static string Encode(string data)
{
if (string.IsNullOrEmpty(data))
{
Expand Down