fixed insert tokens
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
//Numero Thread(?)
|
//Numero Thread(?)
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Sockets;
|
|
||||||
|
|
||||||
namespace LoadTest;
|
namespace LoadTest;
|
||||||
|
|
||||||
@@ -24,6 +23,7 @@ internal class Program
|
|||||||
string? yn;
|
string? yn;
|
||||||
Stopwatch sw;
|
Stopwatch sw;
|
||||||
|
|
||||||
|
using var client = new HttpClient();
|
||||||
Console.WriteLine("Load Test");
|
Console.WriteLine("Load Test");
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -49,22 +49,33 @@ internal class Program
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Console.WriteLine("Is Authentication required? (Y/N)");
|
Console.WriteLine("Are Tokens required? (Y/N)");
|
||||||
yn = Console.ReadLine();
|
yn = Console.ReadLine();
|
||||||
} while(string.IsNullOrEmpty(yn) && (yn?.ToLower() != ConsoleKey.Y.ToString().ToLower() || yn?.ToLower() != ConsoleKey.N.ToString().ToLower()));
|
} while(string.IsNullOrEmpty(yn) && (yn?.ToLower() != ConsoleKey.Y.ToString().ToLower() || yn?.ToLower() != ConsoleKey.N.ToString().ToLower()));
|
||||||
|
|
||||||
if (yn?.ToLower() == "y")
|
if (yn?.ToLower() == "y")
|
||||||
{
|
{
|
||||||
|
ConsoleKey keyPressed;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Console.WriteLine("Header");
|
do
|
||||||
header = Console.ReadLine();
|
{
|
||||||
} while (string.IsNullOrEmpty(header));
|
Console.WriteLine("Header");
|
||||||
do
|
header = Console.ReadLine();
|
||||||
|
} while (string.IsNullOrEmpty(header));
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Console.WriteLine("Token: ");
|
||||||
|
token = Console.ReadLine();
|
||||||
|
} while (string.IsNullOrEmpty(token));
|
||||||
|
Console.WriteLine("Press a key to insert another token, Press Q to stop inserting tokens.");
|
||||||
|
keyPressed = Console.ReadKey().Key;
|
||||||
|
} while (keyPressed == ConsoleKey.Q);
|
||||||
|
if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(header))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Token: ");
|
client.DefaultRequestHeaders.Add(header, token);
|
||||||
token = Console.ReadLine();
|
}
|
||||||
} while (string.IsNullOrEmpty(token));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -75,11 +86,6 @@ internal class Program
|
|||||||
} while (string.IsNullOrEmpty(time));
|
} while (string.IsNullOrEmpty(time));
|
||||||
lTime = long.Parse(time) * 1000;
|
lTime = long.Parse(time) * 1000;
|
||||||
|
|
||||||
using var client = new HttpClient() ;
|
|
||||||
if (yn == "y" && !string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(header))
|
|
||||||
{
|
|
||||||
client.DefaultRequestHeaders.Add(header, token);
|
|
||||||
}
|
|
||||||
switch (methodHttp.ToUpper())
|
switch (methodHttp.ToUpper())
|
||||||
{
|
{
|
||||||
case "GET":
|
case "GET":
|
||||||
|
|||||||
Reference in New Issue
Block a user