예제 #1
0
        private static OptionSet CreateOptions(HttpCallConfiguration configuration)
        {
            var builder = new ConfigurationBuilder(configuration);

            return(new OptionSet()
                   .Add("?|h|help", SetShowHelp)
                   .Add("u=|uri=", "REQUIRED: The URI you want to call",
                        builder.GetServiceUri)
                   .Add("m=|method=", "The HTTP method. Default is GET",
                        builder.GetHttpMethod)
                   .Add("i=|iterations=", "Number of iterations to run, default is 1",
                        builder.GetIterations)
                   .Add("t=|interval=", "Iterval between each call in milliseconds, default is 10000",
                        builder.GetInterval)
                   .Add("p=|postdata=", "Path to file containing post data",
                        builder.LoadPostData)
                   .Add("r|responses", "Print responses",
                        option => configuration.PrintResponse = (option != null))
                   .Add("k|keepalive", "KeepAlive header value (true or false), default is true",
                        builder.GetKeepAlive)
                   .Add("a=|accept=", "Accept header value, default is 'text/xml'",
                        option => configuration.Accept = option ?? "text/xml")
                   .Add("c=|contenttype=", "ContentType header value, default is 'text/xml;charset=\"utf-8\"'",
                        option => configuration.ContentType = option ?? "text/xml;charset=\"utf-8\"")
                   .Add("z=|timeout=", "Timeout in milliseconds, default is 10000",
                        builder.GetTimeout));
        }
예제 #2
0
        private static OptionSet CreateOptions(HttpCallConfiguration configuration)
        {
            var builder = new ConfigurationBuilder(configuration);

            return new OptionSet()
                .Add("?|h|help", SetShowHelp)
                .Add("u=|uri=", "REQUIRED: The URI you want to call",
                    builder.GetServiceUri)
                .Add("m=|method=", "The HTTP method. Default is GET",
                    builder.GetHttpMethod)
                .Add("i=|iterations=", "Number of iterations to run, default is 1",
                    builder.GetIterations)
                .Add("t=|interval=", "Iterval between each call in milliseconds, default is 10000",
                    builder.GetInterval)
                .Add("p=|postdata=", "Path to file containing post data",
                    builder.LoadPostData)
                .Add("r|responses", "Print responses",
                    option => configuration.PrintResponse = (option != null))
                .Add("k|keepalive", "KeepAlive header value (true or false), default is true",
                    builder.GetKeepAlive)
                .Add("a=|accept=", "Accept header value, default is 'text/xml'",
                    option => configuration.Accept = option ?? "text/xml")
                .Add("c=|contenttype=", "ContentType header value, default is 'text/xml;charset=\"utf-8\"'",
                    option => configuration.ContentType = option ?? "text/xml;charset=\"utf-8\"")
                .Add("z=|timeout=", "Timeout in milliseconds, default is 10000",
                    builder.GetTimeout);

        }
예제 #3
0
        public static void Main(string[] args)
        {
            var configuration = new HttpCallConfiguration();
            var optionSet     = CreateOptions(configuration);

            try
            {
                optionSet.Parse(args);

                var client = new RawHttpClient(configuration, Console.Out);
                client.MakeRawHttpCall();
            }
            catch (OptionException exception)
            {
                Console.WriteLine(exception.Message);
                ShowHelp(optionSet);
            }
        }
예제 #4
0
        public static void Main(string[] args)
        {
            var configuration = new HttpCallConfiguration();
            var optionSet = CreateOptions(configuration);

            try
            {
                optionSet.Parse(args);

                var client = new RawHttpClient(configuration, Console.Out);
                client.MakeRawHttpCall();
            }
            catch (OptionException exception)
            {
                Console.WriteLine(exception.Message);
                ShowHelp(optionSet);
            }
        }
예제 #5
0
 public ConfigurationBuilder(HttpCallConfiguration configuration)
 {
     this.configuration = configuration;
 }
예제 #6
0
 public RawHttpClient(HttpCallConfiguration configuration, TextWriter outputWriter)
 {
     this.configuration = configuration;
     this.outputWriter  = outputWriter;
 }
예제 #7
0
 public RawHttpClient(HttpCallConfiguration configuration, TextWriter outputWriter)
 {
     this.configuration = configuration;
     this.outputWriter = outputWriter;
 }
예제 #8
0
 public ConfigurationBuilder(HttpCallConfiguration configuration)
 {
     this.configuration = configuration;
 }