hurl/integration/tests_ok/hello_gb2312.html

13 lines
1.5 KiB
HTML

<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"></span><span class="comment"># In this test, the data returned by the server is encoded using GB2312.</span>
<span class="line"></span><span class="comment"># The 'Content-Type' HTTP response header precise the charset 'gb2312' so</span>
<span class="line"></span><span class="comment"># any text based assert are using GB2312 and can be used.</span>
<span class="line"></span><span class="comment"># See the sibling fail test where there is no charset =&gt; tests_failed/hello_gb2312_failed.hurl</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello_gb2312</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
<span class="line"><span class="section-header">[Asserts]</span></span>
<span class="line"><span class="query-type">header</span> <span class="string">"Content-Type"</span> <span class="predicate-type">==</span> <span class="string">"text/html; charset=gb2312"</span></span>
<span class="line"><span class="query-type">bytes</span> <span class="predicate-type">contains</span> hex,<span class="hex">c4e3bac3cac0bde7</span>;</span> <span class="comment"># 你好世界 encoded in GB2312</span>
<span class="line"><span class="query-type">xpath</span> <span class="string">"string(//body)"</span> <span class="predicate-type">==</span> <span class="string">"你好世界"</span></span>
</span></span><span class="line"></span>
</code></pre>