Skip to content

Commit

Permalink
method GetPostContent don´t permit too long uri
Browse files Browse the repository at this point in the history
There is limitation in class FormUrlEncodedContent about length information sended, in a post HTTP request.
In my case I make a post sending ~200 Kb, but the class FormUrlEncodedContent don´t allowed. 
So I needed change method GetPostContent , changing the class FormUrlEncodedContent  by StringContent and created the request on POST Uri protocol.
  • Loading branch information
alexandercamps authored Nov 5, 2019
1 parent d048561 commit 7cd56cf
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Amazon.Sqs/SqsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,25 @@ public async Task<DeleteMessageBatchResultEntry[]> DeleteMessageBatchAsync(Uri q

#region Helpers

private static FormUrlEncodedContent GetPostContent(SqsRequest request)
private static ByteArrayContent GetPostContent(SqsRequestLAI request)
{
request.Add("Version", Version);

return new FormUrlEncodedContent(request.Parameters);
// Converting the dictionary for Form Url protocol
var parameters = new List<string>();
foreach (var item in request.Parameters)
{
var key = WebUtility.UrlEncode(item.Key);
var value = WebUtility.UrlEncode(item.Value);
parameters.Add($"{key}={value}");
}

// Creating a variable for simply the Debug proccess
string paramString = string.Join("&", parameters);

// Creating a variable for simply the Debug proccess
var content = new StringContent(paramString, null, "application/x-www-form-urlencoded");
return content;
}

protected override async Task<Exception> GetExceptionAsync(HttpResponseMessage response)
Expand Down

0 comments on commit 7cd56cf

Please sign in to comment.