hurl/integration/tests_ok/post_json.html
2022-04-12 07:51:35 +02:00

59 lines
4.2 KiB
HTML

<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>
<span class="line"> "password": "&amp;secret\\'&lt;&gt;",</span>
<span class="line"> "age": 30,</span>
<span class="line"> "strict": true,</span>
<span class="line"> "spacing": "\n",</span>
<span class="line"> "g_clef": "\uD834\uDD1E",</span>
<span class="line"> "items": [true, "true", 1]</span>
<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>