HTTP request code builder
Turn a method, URL, headers and body into ready-to-run curl, Python requests and JavaScript fetch code.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/http-request-build \
-H 'Content-Type: application/json' \
-d '{"input":{"url":"https://api.example.com/items","method":"post","headers":{"Content-Type":"application/json"},"body":"{\"name\": \"Sam'"'"'s\"}"}}'
import json, urllib.request
body = {'input': {'url': 'https://api.example.com/items', 'method': 'post', 'headers': {'Content-Type': 'application/json'}, 'body': '{"name": "Sam\'s"}'}}
request = urllib.request.Request("https://setget.net/v1/tools/http-request-build", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/http-request-build", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"url":"https://api.example.com/items","method":"post","headers":{"Content-Type":"application/json"},"body":"{\"name\": \"Sam's\"}"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "http-request-build",
"input": {
"url": "https://api.example.com/items",
"method": "post",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"name\": \"Sam's\"}"
}
}
{
"input": {
"url": "https://api.example.com/items",
"method": "post",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"name\": \"Sam's\"}"
}
}
Endpoint: POST /v1/tools/http-request-build. Over MCP: run_tool with slug: "http-request-build".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
url |
string | yes | The address to request. |
method |
string | no | The HTTP method. Default: "GET". |
headers |
json | no | Request headers as a JSON object of names and values. |
body |
string | no | The request body, exactly as it should be sent. |
Examples
Input
{
"url": "https://api.example.com/items",
"method": "post",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"name\": \"Sam's\"}"
}Result
{
"curl": "curl -X POST 'https://api.example.com/items' \\\n -H 'Content-Type: application/json' \\\n --data-raw '{\"name\": \"Sam'\\''s\"}'",
"python": "import requests\n\nresponse = requests.request(\n 'POST',\n 'https://api.example.com/items',\n headers={\n 'Content-Type': 'application/json',\n },\n data='{\"name\": \"Sam\\'s\"}',\n)\nprint(response.status_code)\nprint(response.text)",
"javascript": "const response = await fetch(\"https://api.example.com/items\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: \"{\\\"name\\\": \\\"Sam's\\\"}\"\n});\nconsole.log(response.status);\nconsole.log(await response.text());"
}A plain GET
Input
{
"url": "https://example.com/health"
}Result
{
"curl": "curl 'https://example.com/health'",
"python": "import requests\n\nresponse = requests.request(\n 'GET',\n 'https://example.com/health',\n)\nprint(response.status_code)\nprint(response.text)",
"javascript": "const response = await fetch(\"https://example.com/health\", {\n method: \"GET\"\n});\nconsole.log(response.status);\nconsole.log(await response.text());"
}Questions
- Is the request sent?
- No. Only the code is produced. Run it yourself to make the request.
- How are quotes in my data handled?
- Each snippet escapes them for its own language, so the body arrives exactly as you wrote it.
- Why is my JSON body a string?
- The body is sent as written, byte for byte. Set the Content-Type header yourself, for example to application/json.
Related tools
- curl command converterParse a curl command into method, URL, headers, body and options, with equivalent Python and JavaScript code.
curl-to-json - HTTP status code lookupLook up an HTTP status code or search by words: meaning, typical cause and whether to retry.
http-status - HTTP headers parserTurn a raw block of HTTP headers into JSON, explain the well-known ones and audit security headers.
http-headers-parse - URL parserSplit a URL into scheme, login, host, port, path, query parameters and fragment.
url-parse - .gitignore testerCheck which paths a .gitignore file ignores and which line decided each one, using real Git matching rules.
gitignore-test - Cache-Control explainerExplain a Cache-Control header directive by directive and how browsers and CDNs will treat the response.
cache-control-explain