mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-18 16:11:34 +03:00
13 lines
1.5 KiB
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"># Meanwhile, the 'Content-Type' HTTP response header doesn't precise</span>
|
||
|
<span class="line"></span><span class="comment"># any charset. In this case, any text based assert default to UFT-8 encoding and</span>
|
||
|
<span class="line"></span><span class="comment"># will probably fail.</span>
|
||
|
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello_gb2312_failed</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"</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>
|