Marco Borgeaud 95ce8c6119
Diff blocks: fix some incorrect use for javascript (#2802)
Improvement identified in #2790.

Add a prefix to the diff-id when it is used multiple times in different
"how to fix it in XYZ" sections to avoid ambiguity and pedantically
follow the spec:

> A single and unique diff-id should be used only once for each type of
code example as shown in the description of a rule.

Obvious typos around `diff-type` were fixed.
2023-08-15 09:43:48 +02:00

41 lines
827 B
Plaintext

== 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[]