hurl/integration/tests_ok/post_json.html

60 lines
4.2 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 class="method">POST</span> <span class="url">http://localhost:8000/post-json</span></span>
<span class="line"></span>
<span class="json"><span class="line">{</span>
<span class="line"> "name": "Bob",</span>
2022-04-11 11:53:52 +03:00
<span class="line"> "password": "&amp;secret\\'&lt;&gt;",</span>
2021-09-21 07:36:53 +03:00
<span class="line"> "age": 30,</span>
<span class="line"> "strict": true,</span>
<span class="line"> "spacing": "\n",</span>
2022-03-09 11:51:17 +03:00
<span class="line"> "g_clef": "\uD834\uDD1E",</span>
2022-06-21 10:19:13 +03:00
<span class="line"> "items": [true, "true", 1],</span>
<span class="line"> "variable": "{{string_variable}}"</span>
2021-09-21 07:36:53 +03:00
<span class="line">}</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</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">POST</span> <span class="url">http://localhost:8000/post-json-array</span></span>
<span class="json"><span class="line">[1,2,3]</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</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">POST</span> <span class="url">http://localhost:8000/post-json-string</span></span>
<span class="json"><span class="line">"Hello"</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</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">POST</span> <span class="url">http://localhost:8000/post-json-number</span></span>
<span class="json"><span class="line">100</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</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">POST</span> <span class="url">http://localhost:8000/post-json-numbers</span></span>
<span class="json"><span class="line">{</span>
<span class="line"> "natural": 100,</span>
<span class="line"> "negative": -1,</span>
<span class="line"> "float": "3.333333333333333",</span>
<span class="line"> "exponent": 100e100</span>
<span class="line">}</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</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">POST</span> <span class="url">http://localhost:8000/post-json-boolean</span></span>
<span class="json"><span class="line">true</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</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">#</span>
<span class="line"></span><span class="comment"># Use variable in your input json</span>
<span class="line"></span><span class="comment">#</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/get-name</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="line section-header">[Captures]</span>
<span class="line"><span class="name">name</span><span>:</span> <span class="query-type">body</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">POST</span> <span class="url">http://localhost:8000/check_name</span></span>
<span class="line"></span>
<span class="json"><span class="line">{</span>
<span class="line"> "name": "{{name}}"</span>
<span class="line">}</span></span>
</span></span></code></pre>