hurl/integration/tests_ok/cookies.html

66 lines
7.5 KiB
HTML
Raw Normal View History

2021-09-21 07:36:53 +03:00
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"></span><span class="comment"># Request Cookie</span>
<span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/cookies/set-request-cookie1-valueA</span></span>
<span class="line section-header">[Cookies]</span>
2023-01-11 14:14:32 +03:00
<span class="line"><span class="name">cookie1</span><span>:</span> <span class="string">valueA</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span><span class="comment"># The cookie is not added in the cookie storage</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/cookies/assert-that-cookie1-is-not-in-session</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
</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/cookies/set-multiple-request-cookies</span></span>
<span class="line section-header">[Cookies]</span>
2023-01-11 14:14:32 +03:00
<span class="line"><span class="name">user1</span><span>:</span> <span class="string">Bob</span></span>
<span class="line"><span class="name">user2</span><span>:</span> <span class="string">Bill</span></span>
<span class="line"><span class="name">user3</span><span>:</span> <span class="string">{{name}}</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span>
<span class="line"></span><span class="comment"># Session Cookie</span>
<span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/cookies/set-session-cookie2-valueA</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
<span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"cookie2"</span> <span class="predicate-type">==</span> <span class="string">"valueA"</span></span>
2021-09-21 07:36:53 +03:00
</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/cookies/assert-that-cookie2-is-valueA</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
</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/cookies/assert-that-cookie2-is-valueA-and-valueB</span></span>
<span class="line section-header">[Cookies]</span>
2023-01-11 14:14:32 +03:00
<span class="line"><span class="name">cookie2</span><span>:</span> <span class="string">valueB</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/cookies/delete-cookie2</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
<span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"cookie2"</span> <span class="predicate-type">==</span> <span class="string">""</span></span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"cookie2[Max-Age]"</span> <span class="predicate-type">==</span> <span class="number">0</span></span>
2021-09-21 07:36:53 +03:00
</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/cookies/assert-that-cookie2-is-not-in-session</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
</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/cookies/set</span></span>
2022-11-11 16:25:00 +03:00
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
2021-09-21 07:36:53 +03:00
<span class="line"><span class="string">Set-Cookie</span><span>:</span> <span class="string">LSID=DQAAAKEaem_vYg; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly; Path=/accounts</span></span>
<span class="line"><span class="string">Set-Cookie</span><span>:</span> <span class="string">HSID=AYQEVnDKrdst; Domain=.localhost; Expires=Wed, 13 Jan 2021 22:23:01 GMT; HttpOnly; Path=/</span></span>
<span class="line"><span class="string">Set-Cookie</span><span>:</span> <span class="string">SSID=Ap4PGTEq; Domain=.localhost; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly; Path=/</span></span>
<span class="line"></span>
<span class="line section-header">[Asserts]</span>
2022-10-25 09:59:18 +03:00
<span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="filter-type">count</span> <span class="predicate-type">==</span> <span class="number">3</span></span>
2021-09-21 07:36:53 +03:00
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID"</span> <span class="predicate-type">equals</span> <span class="string">"DQAAAKEaem_vYg"</span></span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Value]"</span> <span class="predicate-type">==</span> <span class="string">"DQAAAKEaem_vYg"</span></span>
2021-09-21 07:36:53 +03:00
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Expires]"</span> <span class="predicate-type">exists</span></span>
2023-02-05 21:05:49 +03:00
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Expires]"</span> <span class="filter-type">format</span> <span class="string">"%a, %d %b %Y %H:%M:%S"</span> <span class="predicate-type">==</span> <span class="string">"Wed, 13 Jan 2021 22:23:01"</span></span>
2021-09-21 07:36:53 +03:00
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Max-Age]"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Domain]"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Path]"</span> <span class="predicate-type">==</span> <span class="string">"/accounts"</span></span>
2021-09-21 07:36:53 +03:00
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Secure]"</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[HttpOnly]"</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[SameSite]"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span>
</span></span><span class="line"></span>
<span class="line"></span>
</code></pre>