Как я могу увидеть прикрепленные параметры и заголовки в Fiddler? - PullRequest
0 голосов
/ 27 февраля 2020

У меня есть следующий код (Core 3.1 в VS2019):

                var client = new RestClient(url);

                ServicePointManager.Expect100Continue = true;
                ServicePointManager.DefaultConnectionLimit = 9999;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                // Add certificate
                var certFile = Path.Combine(certificateFolder, certificateFile);
                X509Certificate2 certificate = new X509Certificate2(certFile, certificatePassword);
                client.ClientCertificates = new X509CertificateCollection() { certificate };

                // Set web proxy
               // client.Proxy = new WebProxy(proxyUrl, proxyPort) { BypassProxyOnLocal = false };
                client.Proxy = new WebProxy("127.0.0.1", 8888);

                // Create request; add headers and parameters
                var request = new RestRequest(Method.POST);
                request.AddParameter("Authorization", authorization, ParameterType.HttpHeader);
                request.AddParameter("Content-Type", "application/x-www-form-urlencoded", ParameterType.HttpHeader);
                request.AddParameter("grant_type", "client_cert");
                request.AddParameter("scope", "openid");
                IRestResponse response = client.Execute(request);

                if (!response.IsSuccessful || response.StatusCode != HttpStatusCode.OK || response.ErrorException != null)
                {
                    throw new Exception("Unexpected response.");
                }

                System.Diagnostics.Debug.WriteLine(response);

У меня есть прокси, установленный на локальный хост, чтобы я мог фиксировать то, что происходит в Fiddler.

В Fiddler показывает следующую ошибку:

fiddler.network.https> HTTPS handshake to myApiEndpointUrl (for #25) failed. System.Security.Authentication.AuthenticationException A call to SSPI failed, see inner exception. < The message received was unexpected or badly formatted

Win32 (SChannel) Native Error Code: 0x80090326

Когда я смотрю на вкладку Headers (в Fiddler), все, что она показывает, это:

Response Headers
HTTP/1.1 200 Connection established

Другие вкладки показывают аналогичные или ничего.

Вопросы: 1. Как я могу посмотреть, что на самом деле отправляется, другими словами, правильно ли подключены заголовки и параметры? 2. Даже когда я смотрю на значение запроса в режиме отладки во время выполнения, он не дает мне возможности увидеть заголовки / параметры.

Спасибо,

...