Skip to content

Commit

Permalink
Merge pull request #8 from betalgo/dev
Browse files Browse the repository at this point in the history
version 0.0.0.5
  • Loading branch information
kayhantolga committed Dec 15, 2021
2 parents ae4be31 + a90f63a commit 6109f9e
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 53 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>0.0.4</Version>
<Version>0.0.5</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>0.0.4</Version>
<Version>0.0.5</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
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>0.0.4</Version>
<Version>0.0.5</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand Down
2 changes: 2 additions & 0 deletions LaserCatEyes.Domain/Models/LaserCatEyesOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace LaserCatEyes.Domain.Models
{
public class LaserCatEyesOptions
{
public static string SettingKey = "LaserCatEyesOptions";

public LaserCatEyesOptions(string appKey)
{
AppKey = appKey;
Expand Down
2 changes: 1 addition & 1 deletion LaserCatEyes.EndpointListener/HttpListenerMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
replacementResponseBody.Position = 0;
await replacementResponseBody.CopyToAsync(originalResponseBody);
context.Response.Body = originalResponseBody;
_laserCatEyesDataService.Report(PackageData.CreateResponsePackage(
_laserCatEyesDataService.Report(PackageData.CreateResponsePackage(
operationId,
context.Response.StatusCode,
context.Response.Headers.SelectMany(r => r.Value.Select(value => $"{r.Key}:{value}")).ToList(),
Expand Down
73 changes: 38 additions & 35 deletions LaserCatEyes.EndpointListener/LaserCatEyes.EndpointListener.csproj
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Copyright>Betalgo Up Ltd.</Copyright>
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.4</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
<Description>
lasercateyes.com
Laser Cat Eyes is an online debugging tool that can capture, inspect, monitor all HTTP/HTTPS traffic from your application. It contains a network function like diagnose network issues, etc.
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Copyright>Betalgo Up Ltd.</Copyright>
<PackageProjectUrl>https://portal.lasercateyes.com</PackageProjectUrl>
<PackageIcon>LaserCatEyes_Logo.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.5</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
<Description>
lasercateyes.com
Laser Cat Eyes is an online debugging tool that can capture, inspect, monitor all HTTP/HTTPS traffic from your application. It contains a network function like diagnose network issues, etc.

With Laser Cat Eyes all team members can remotely display in realtime all traffic smoothly that other members capture in their device. It allows team members to test and debug scripts right along with each other in realtime remotely. Laser Cat Eyes is a comprehensive helper to save time, to improve productivity with its easy to use layout, also it helps to play a lot with request and response.
With Laser Cat Eyes all team members can remotely display in realtime all traffic smoothly that other members capture in their device. It allows team members to test and debug scripts right along with each other in realtime remotely. Laser Cat Eyes is a comprehensive helper to save time, to improve productivity with its easy to use layout, also it helps to play a lot with request and response.

All internal traffics that we are sending and receiving between the web browser/client and the server is invisible, and this brings difficulty, stress. Determining where is the fault exactly is a time-consuming process, a small error can sometimes take hours to debug with different browsers, operating systems, and devices, bugs are inevitable. Laser Cat Eyes offers extensive features that make it easy to see what is happening, so you debug your application effectively, quickly diagnose, and fix problems.
</Description>
<RepositoryUrl>https://github.com/betalgo/LCE-DotNet-SDK</RepositoryUrl>
<PackageTags>network, debugging</PackageTags>
</PropertyGroup>
All internal traffics that we are sending and receiving between the web browser/client and the server is invisible, and this brings difficulty, stress. Determining where is the fault exactly is a time-consuming process, a small error can sometimes take hours to debug with different browsers, operating systems, and devices, bugs are inevitable. Laser Cat Eyes offers extensive features that make it easy to see what is happening, so you debug your application effectively, quickly diagnose, and fix problems.
</Description>
<RepositoryUrl>https://github.com/betalgo/LCE-DotNet-SDK</RepositoryUrl>
<PackageTags>network, debugging</PackageTags>
</PropertyGroup>

<ItemGroup>
<None Include="LaserCatEyes_Logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<None Include="LaserCatEyes_Logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\LaserCatEyes.DataServiceSdk\LaserCatEyes.DataServiceSdk.csproj" />
</ItemGroup>
</Project>
<ItemGroup>
<ProjectReference Include="..\LaserCatEyes.DataServiceSdk\LaserCatEyes.DataServiceSdk.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using LaserCatEyes.Domain;
using LaserCatEyes.Domain.Models;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
Expand All @@ -14,14 +15,24 @@ public static class LaserCatEyesServiceCollectionExtensions
public static IServiceCollection AddLaserCatEyesEndpointListener(this IServiceCollection services, Action<LaserCatEyesOptions> setupAction)
{
services.TryAddSingleton<IConfigureOptions<LaserCatEyesOptions>>(new ConfigureNamedOptions<LaserCatEyesOptions>(setupAction.Method.Name, setupAction));
services.TryAddSingleton<ILaserCatEyesDataService, LaserCatEyesDataService>();
services.AddTransient<EndpointListenerMiddleware>();
return services;
return AddLaserCatEyesEndpointListenerBase(services);
}

public static IServiceCollection AddLaserCatEyesEndpointListener(this IServiceCollection services)
{
var configuration = services.BuildServiceProvider().GetRequiredService<IConfiguration>();
services.Configure<LaserCatEyesOptions>(configuration.GetSection(LaserCatEyesOptions.SettingKey));
return AddLaserCatEyesEndpointListenerBase(services);
}

public static IServiceCollection AddLaserCatEyesEndpointListener(this IServiceCollection services, string appKey)
{
services.TryAddSingleton(Options.Create(new LaserCatEyesOptions(appKey)));
return AddLaserCatEyesEndpointListenerBase(services);
}

private static IServiceCollection AddLaserCatEyesEndpointListenerBase(IServiceCollection services)
{
services.TryAddSingleton<ILaserCatEyesDataService, LaserCatEyesDataService>();
services.AddTransient<EndpointListenerMiddleware>();
return services;
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>0.0.4</Version>
<Version>0.0.5</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>0.0.4</Version>
<Version>0.0.5</Version>
<Authors>Betalgo Up Ltd.</Authors>
<Company>Betalgo Up Ltd.</Company>
<Product>Laser Cat Eyes</Product>
Expand All @@ -22,8 +22,19 @@
<PackageTags>network, debugging</PackageTags>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>9</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
_laserCatEyesDataService.Report(PackageDataHelper.RequestPackageDataFromHttpRequestMessage(operationId, request));

var response = await base.SendAsync(request, cancellationToken);

_laserCatEyesDataService.Report(PackageDataHelper.ResponsePackageDataFromHttpResponseMessage(operationId, response));
return response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using LaserCatEyes.DataServiceSdk;
using LaserCatEyes.Domain;
using LaserCatEyes.Domain.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Http;
Expand All @@ -11,6 +12,19 @@ namespace LaserCatEyes.HttpClientListener
{
public static class HttpClientListenerServiceCollectionExtensions
{
public static IServiceCollection AddLaserCatEyesHttpClientListener(this IServiceCollection services, LaserCatEyesOptions options, bool listenAllHttpClients = true)
{
services.TryAddSingleton(options);
return AddLaserCatEyesHttpClientListenerBase(services, listenAllHttpClients);
}

public static IServiceCollection AddLaserCatEyesHttpClientListener(this IServiceCollection services, bool listenAllHttpClients = true)
{
var configuration = services.BuildServiceProvider().GetRequiredService<IConfiguration>();
services.Configure<LaserCatEyesOptions>(configuration.GetSection(LaserCatEyesOptions.SettingKey));
return AddLaserCatEyesHttpClientListenerBase(services, listenAllHttpClients);
}

public static IServiceCollection AddLaserCatEyesHttpClientListener(this IServiceCollection services, string appKey, bool listenAllHttpClients = true)
{
services.TryAddSingleton(Options.Create(new LaserCatEyesOptions(appKey)));
Expand All @@ -34,6 +48,7 @@ private static IServiceCollection AddLaserCatEyesHttpClientListenerBase(IService
options.HttpMessageHandlerBuilderActions.Add(builder => { builder.AdditionalHandlers.Add(builder.Services.GetRequiredService<LaserCatEyesHttpMessageHandler>()); });
});
}

return services;
}
}
Expand Down
12 changes: 8 additions & 4 deletions Sample/SampleDotNetCoreClientApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
using System.Threading;
using System.Threading.Tasks;
using Bogus;
using LaserCatEyes.DataServiceSdk;
using LaserCatEyes.Domain.Models;
using LaserCatEyes.HttpClientListener;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace SampleDotNetCoreClientApp
Expand All @@ -17,11 +16,16 @@ internal class Program
private static async Task Main(string[] args)
{
const string baseDomain = "https://localhost:44328";


var serviceCollection = new ServiceCollection().AddLogging();

var builder = new ConfigurationBuilder()
.AddUserSecrets<Program>();
IConfiguration configuration = builder.Build();
serviceCollection.AddScoped(_ => configuration);

serviceCollection.AddHttpClient<ISimpleClass, SimpleClass>();
serviceCollection.AddLaserCatEyesHttpClientListener("cd579d47-eafb-44df-bfc7-ad1f4dd013d5");
serviceCollection.AddLaserCatEyesHttpClientListener();

var serviceProvider = serviceCollection.BuildServiceProvider();
var simpleClass = serviceProvider.GetRequiredService<ISimpleClass>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>550e8434-d2dc-4997-8cda-fe3c4e5a5e86</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.13" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Sample/SampleNetServerApp/SampleNetServerApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>996389f1-bb0b-4803-b991-ea410c2bb2b0</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" NoWarn="NU1605" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Sample/SampleNetServerApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public void ConfigureServices(IServiceCollection services)
{
if (_env.IsDevelopment())
{
services.AddLaserCatEyesEndpointListener("cd579d47-eafb-44df-bfc7-ad1f4dd013d5");
services.AddLaserCatEyesHttpClientListener("cd579d47-eafb-44df-bfc7-ad1f4dd013d5");
services.AddLaserCatEyesEndpointListener();
services.AddLaserCatEyesHttpClientListener();
}

services.AddControllers();
Expand Down

0 comments on commit 6109f9e

Please sign in to comment.