hurl/integration/tests_ok/http_version_option.html
2023-10-04 14:42:47 +02:00

48 lines
4.8 KiB
HTML

<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/http_version/10</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.0</span>: <span class="boolean">true</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span><span class="comment"># RFC 2616 requires that HTTP servers always begin their responses with</span>
<span class="line"></span><span class="comment"># the highest HTTP version that they claim to support. So the HTTP version can</span>
<span class="line"></span><span class="comment"># be different from what the client used in their request.</span>
<span class="line"></span><span class="comment"># See &lt;https://serverfault.com/questions/1059870/why-does-apache-send-http-1-1-when-client-requests-http-1-0-and-many-other-very&gt;</span>
<span class="line"></span><span class="comment"># We validate on the Flask endpoint `http_version.py` that the version asked by the client is the right one.</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/http_version/10</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.0</span>: <span class="boolean">true</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.1</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span><span class="comment"># Default HTTP version for Flask is HTTP/1.1</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/http_version/11</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/http_version/11</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.1</span>: <span class="boolean">true</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span><span class="comment"># The last option win</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/http_version/11</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.0</span>: <span class="boolean">true</span></span>
<span class="line"><span class="string">http1.1</span>: <span class="boolean">true</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/http_version/11</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.0</span>: <span class="boolean">false</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span><span class="comment"># Live test on google.fr</span>
<span class="line"><span class="method">HEAD</span> <span class="url">https://google.com</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.0</span>: <span class="boolean">true</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">*</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">HEAD</span> <span class="url">https://google.com</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">http1.1</span>: <span class="boolean">true</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.1</span> <span class="number">*</span></span>
</span></span></code></pre>