== How to fix it in Request

=== Code examples

include::../../common/fix/code-rationale.adoc[]

:cert_variable_name: rejectUnauthorized
:cert_variable_unsafe_value: false
:cert_variable_safe_value: true

include::../../common/fix/code-rationale-setting.adoc[]

==== Noncompliant code example

[source,javascript,diff-id=11,diff-type=noncompliant]
----
const request = require('request');

let socket = request.get({
  url: 'www.example.com',
  rejectUnauthorized: false, // Noncompliant
  secureProtocol: 'TLSv1_2_method'
});
----

==== Compliant solution

[source,javascript,diff-id=11,diff-type=compliant]
----
const request = require('request');

let socket = request.get({
  url: 'https://www.example.com/',
  secureProtocol: 'TLSv1_2_method'
});
----

=== How does this work?

include::../../common/fix/validation.adoc[]
