Skip to content

Commit

Permalink
null body fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhantolga committed Apr 8, 2022
1 parent 9fe3bab commit d2bc137
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
22 changes: 8 additions & 14 deletions LaserCatEyes.DataServiceSdk/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,15 @@ public static MethodType HttpMethodStringToEnumConverter(string method)

public static async Task<string> ReadBodyStream(Stream body)
{
if (!body.CanRead)
{
return null;
}

if (body.Length == 0)
{
return null;
}

body.Position = 0;

using var reader = new StreamReader(body, leaveOpen: true);
var bodyString = await reader.ReadToEndAsync().ConfigureAwait(false);
using var reader = new StreamReader(
body,
Encoding.UTF8,
false,
leaveOpen: true);
var tempPosition = body.Position;
body.Position = 0;
var bodyString = await reader.ReadToEndAsync();
body.Position = tempPosition;

return bodyString;
}
Expand Down
2 changes: 1 addition & 1 deletion LaserCatEyes.Domain/LaserCatEyes.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
4 changes: 3 additions & 1 deletion Sample/SampleDotNetCoreClientApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ private static async Task Main(string[] args)
serviceCollection.AddScoped(_ => configuration);

serviceCollection.AddHttpClient<ISimpleClass, SimpleClass>();

serviceCollection.AddLaserCatEyesHttpClientListener();

var serviceProvider = serviceCollection.BuildServiceProvider();
var simpleClass = serviceProvider.GetRequiredService<ISimpleClass>();
var client = serviceProvider.GetRequiredService<HttpClient>();
var clientX = serviceProvider.GetRequiredService<IHttpClientFactory>();
var client = clientX.CreateClient();
await simpleClass.GetData();

var testDataFaker = new Faker<TestData>()
Expand Down

0 comments on commit d2bc137

Please sign in to comment.