>
apps.curlToFetch.name
apps.curlToFetch.description
// apps.curlToFetch.ui.input
$ apps.curlToFetch.ui.samples
// apps.curlToFetch.ui.inputHint// apps.curlToFetch.ui.parsed
POSThttps://api.example.com/posts
$ apps.curlToFetch.ui.headers (1)
- Content-Type
- application/json
$ apps.curlToFetch.ui.options
- apps.curlToFetch.ui.timeout
- 10000 ms
$ apps.curlToFetch.ui.body
{"title":"Hello","tags":["curl","fetch"],"draft":false}// apps.curlToFetch.ui.output
request.js
const response = await fetch("https://api.example.com/posts", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "Hello",
tags: ["curl", "fetch"],
draft: false,
}),
signal: AbortSignal.timeout(10000),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);