-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp-request-builder.html
More file actions
752 lines (709 loc) · 57.2 KB
/
Copy pathhttp-request-builder.html
File metadata and controls
752 lines (709 loc) · 57.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTTP Request Builder — cURL & fetch | FreeDevTool</title>
<meta name="description" content="Build HTTP requests visually. Generate cURL, fetch, axios, Python requests, and Node fetch code. Send live, view response. Browser-only, free.">
<meta name="robots" content="index, follow">
<meta name="author" content="Anees Ur Rehman">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","datePublished":"2026-05-02","dateModified":"2026-05-19","inLanguage":"en-US","isPartOf":{"@type":"WebSite","name":"FreeDevTool","url":"https://freedevtool.org"}}</script>
<script type="application/ld+json">{"@context":"https://schema.org","@type":"Person","name":"Anees Ur Rehman","url":"https://freedevtool.org/about","jobTitle":"Full-stack developer","worksFor":{"@type":"Organization","name":"FreeDevTool","url":"https://freedevtool.org"}}</script>
<link rel="canonical" href="https://freedevtool.org/http-request-builder">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=DM+Sans:wght@300;400;500;600&display=swap" as="style">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=DM+Sans:wght@300;400;500;600&display=swap">
<link rel="preload" href="style.css?v=20260502-cards" as="style">
<link rel="stylesheet" href="style.css?v=20260502-cards">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/favicon.svg">
<meta property="og:image" content="https://freedevtool.org/og-image.svg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="FreeDevTool — 50+ free, fast, privacy-first developer tools">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://freedevtool.org/og-image.svg">
<meta name="twitter:title" content="HTTP Request Builder — cURL, fetch, axios Free">
<meta name="twitter:description" content="Compose HTTP requests visually and generate cURL, fetch, axios, Python requests, and Node fetch code. Send live, view response, browser-only.">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3L0CMH3X36"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag('js',new Date());gtag('config','G-3L0CMH3X36');</script>
<meta property="og:title" content="HTTP Request Builder — Free Online cURL Generator">
<meta property="og:description" content="Build HTTP requests, generate cURL/fetch/axios/Python code, and send requests live in your browser.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://freedevtool.org/http-request-builder">
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebApplication","name":"HTTP Request Builder","url":"https://freedevtool.org/http-request-builder","description":"Visual HTTP request builder that generates cURL, fetch, axios, Python requests, and Node fetch code with live request sending.","applicationCategory":"DeveloperApplication","operatingSystem":"Any","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}
</script>
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is an HTTP request builder?","acceptedAnswer":{"@type":"Answer","text":"An HTTP request builder is a tool for composing HTTP requests through a visual UI — choosing a method, URL, headers, query parameters, and body — and generating the corresponding code in different languages and libraries. It speeds up prototyping API calls, reproducing issues, sharing requests with teammates, and embedding calls in scripts or production code."}},{"@type":"Question","name":"What code formats does this tool generate?","acceptedAnswer":{"@type":"Answer","text":"Five output formats are produced live as you edit the request: cURL (with proper single-quote escaping and backslash line continuations), browser fetch() in JavaScript, axios, Python requests (with json= or data= depending on content), and Node.js fetch. Each output tab has its own copy button."}},{"@type":"Question","name":"Why does sending the request fail with a CORS error?","acceptedAnswer":{"@type":"Answer","text":"The browser enforces the Same-Origin Policy, so requests to third-party APIs only succeed when the server explicitly returns the Access-Control-Allow-Origin header. APIs that don't set permissive CORS headers (most private or internal APIs) will fail from a browser. Use the generated cURL or Python code from a terminal to bypass CORS — it only restricts browser JS, not server-side or CLI clients."}},{"@type":"Question","name":"Does this tool store or log my requests?","acceptedAnswer":{"@type":"Answer","text":"No. The entire tool runs client-side in your browser; code generation happens in JavaScript locally. When you use the 'Send request' feature, the request goes directly from your browser to the target URL — it never touches this site's servers. Still, avoid pasting long-lived production API keys into any online builder."}},{"@type":"Question","name":"How do I send a JSON body?","acceptedAnswer":{"@type":"Answer","text":"Select POST, PUT, or PATCH, click 'Content-Type: application/json' in the header quick-add row, and paste your JSON into the body textarea. Toggle 'Validate JSON' to confirm syntax before sending. The generated Python code will automatically use json= (so requests serializes and sets the header), and the cURL output quotes the body safely with single quotes."}},{"@type":"Question","name":"Can I test APIs in the browser?","acceptedAnswer":{"@type":"Answer","text":"Yes, for any API that has CORS configured to allow your browser origin. For CORS-restricted APIs you need a desktop client (Postman, Insomnia, curl) or a proxy. Browser-based tools are perfect for testing your own APIs; desktop tools are required for third-party APIs without CORS."}},{"@type":"Question","name":"How do I send POST requests with JSON?","acceptedAnswer":{"@type":"Answer","text":"Set the HTTP method to POST, add Content-Type application/json header, put the JSON payload in the body. The fetch API call: fetch(url, method POST, headers Content-Type, body JSON.stringify(data)). Most browser-based clients autofill these fields."}},{"@type":"Question","name":"Why does my API return CORS error in browser tests?","acceptedAnswer":{"@type":"Answer","text":"The target server is not allowing requests from your browser origin. For your own API, add the Access-Control-Allow-Origin header. For third-party APIs without CORS, you must call from a server (not browser). Use a desktop client or backend proxy."}}]}
</script>
<style>
.rb-row{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.rb-row select,.rb-row input{padding:10px 12px;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);color:var(--text);font-family:var(--mono);font-size:13px}
.rb-row select{min-width:110px}
.rb-row input.rb-url{flex:1;min-width:240px}
.rb-row input:focus,.rb-row select:focus,.rb-row textarea:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px rgba(0,208,132,.08)}
.rb-section{margin-top:18px}
.rb-section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.rb-section h3{font-size:12px;text-transform:uppercase;letter-spacing:1px;color:var(--accent);font-family:var(--mono);margin:0;font-weight:600}
.rb-add{padding:4px 10px;font-size:11px;font-family:var(--mono);background:var(--bg4);border:1px solid var(--border);border-radius:12px;color:var(--text2);cursor:pointer}
.rb-add:hover{border-color:var(--accent);color:var(--accent)}
.rb-kv{display:flex;gap:6px;margin-bottom:6px}
.rb-kv input{flex:1;min-width:0;padding:8px 10px;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);color:var(--text);font-family:var(--mono);font-size:12px}
.rb-kv button{padding:6px 10px;background:var(--bg4);border:1px solid var(--border);border-radius:var(--radius);color:var(--text3);font-family:var(--mono);font-size:12px;cursor:pointer}
.rb-kv button:hover{border-color:#ff6b6b;color:#ff6b6b}
.rb-quick{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.rb-quick button{padding:4px 10px;font-size:11px;font-family:var(--mono);background:var(--bg4);border:1px solid var(--border);border-radius:20px;color:var(--text2);cursor:pointer;transition:all .2s}
.rb-quick button:hover{border-color:var(--accent);color:var(--accent)}
.rb-body textarea{width:100%;min-height:110px;padding:10px 12px;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);color:var(--text);font-family:var(--mono);font-size:12px;resize:vertical;box-sizing:border-box}
.rb-body-meta{display:flex;gap:12px;font-size:11px;font-family:var(--mono);color:var(--text3);margin-top:6px;align-items:center}
.rb-body-meta label{cursor:pointer}
.rb-body-meta .valid{color:var(--accent)}
.rb-body-meta .invalid{color:#ff6b6b}
.rb-tabs{display:flex;gap:2px;margin-top:22px;border-bottom:1px solid var(--border);flex-wrap:wrap}
.rb-tab{padding:9px 14px;font-size:12px;font-family:var(--mono);background:transparent;border:0;color:var(--text3);cursor:pointer;border-bottom:2px solid transparent;transition:all .2s}
.rb-tab:hover{color:var(--text2)}
.rb-tab.active{color:var(--accent);border-bottom-color:var(--accent)}
.rb-output{position:relative;margin-top:0}
.rb-output pre{margin:0;padding:14px;background:var(--bg);border:1px solid var(--border);border-top:0;border-radius:0 0 var(--radius) var(--radius);max-height:360px;overflow:auto;font-family:var(--mono);font-size:12px;color:var(--text);white-space:pre-wrap;word-break:break-all}
.rb-copy{position:absolute;top:8px;right:8px;padding:5px 12px;background:var(--bg4);border:1px solid var(--border);border-radius:var(--radius);color:var(--text2);font-family:var(--mono);font-size:11px;cursor:pointer;z-index:2}
.rb-copy:hover{border-color:var(--accent);color:var(--accent)}
.rb-send{margin-top:18px;padding:12px 22px;background:var(--accent);color:#000;border:0;border-radius:var(--radius);font-family:var(--mono);font-weight:600;font-size:13px;cursor:pointer}
.rb-send:hover{opacity:.85}
.rb-send:disabled{opacity:.5;cursor:not-allowed}
.rb-response{margin-top:14px;padding:12px;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);font-family:var(--mono);font-size:12px;display:none}
.rb-response.show{display:block}
.rb-resp-status{font-weight:600;margin-bottom:6px}
.rb-resp-status.ok{color:var(--accent)}
.rb-resp-status.err{color:#ff8888}
.rb-resp-headers{max-height:140px;overflow:auto;color:var(--text3);margin-bottom:8px;white-space:pre-wrap}
.rb-resp-body{max-height:260px;overflow:auto;color:var(--text);white-space:pre-wrap;word-break:break-all;padding-top:8px;border-top:1px solid var(--border)}
.rb-cors-note{font-size:11px;color:var(--text3);font-family:var(--mono);margin-top:8px;line-height:1.6}
.rb-cors-note strong{color:var(--text2)}
@media(max-width:600px){.rb-row input.rb-url{min-width:100%}.rb-tab{padding:8px 10px;font-size:11px}}
</style>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://freedevtool.org/"
},
{
"@type": "ListItem",
"position": 2,
"name": "All Tools",
"item": "https://freedevtool.org/all-tools"
},
{
"@type": "ListItem",
"position": 3,
"name": "HTTP Request Builder",
"item": "https://freedevtool.org/http-request-builder"
}
]
}
</script>
<script src="/ga4-events.js" defer></script>
</head>
<body>
<nav>
<a class="nav-logo" href="/" aria-label="FreeDevTool home"><svg class="logo-mark" width="22" height="22" viewBox="0 0 24 24" aria-hidden="true" fill="none"><rect x="1" y="1" width="22" height="22" rx="6" fill="currentColor" opacity=".12"/><path d="M9.5 8.5L6 12l3.5 3.5M14.5 8.5L18 12l-3.5 3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>FreeDevTool</a>
<div class="nav-links">
<div class="nav-dropdown" id="tools-dropdown">
<a href="all-tools" onclick="event.preventDefault();this.parentElement.classList.toggle('open')" aria-haspopup="true">Tools <svg class="chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg></a>
<div class="nav-dropdown-menu">
<a href="encoding-tools">
<div class="dd-icon">b64</div>
<div class="dd-info"><div class="dd-name">Encoding & Conversion</div><div class="dd-count">11 tools · Base64, YAML, px→rem</div></div>
</a>
<a href="generation-tools">
<div class="dd-icon">{ }</div>
<div class="dd-info"><div class="dd-name">Generation & Formatting</div><div class="dd-count">16 tools · JSON, SQL, gradients</div></div>
</a>
<a href="security-tools">
<div class="dd-icon">#</div>
<div class="dd-info"><div class="dd-name">Security & Hashing</div><div class="dd-count">3 tools · JWT, MD5, SHA</div></div>
</a>
<a href="text-tools">
<div class="dd-icon">.*</div>
<div class="dd-info"><div class="dd-name">Code & Text Tools</div><div class="dd-count">9 tools · Regex, diff, tokens</div></div>
</a>
<a href="devops-tools">
<div class="dd-icon">JS</div>
<div class="dd-info"><div class="dd-name">Optimization & DevOps</div><div class="dd-count">7 tools · Minifiers, cURL, git</div></div>
</a>
<a href="network-tools">
<div class="dd-icon">IP</div>
<div class="dd-info"><div class="dd-name">Network & Time</div><div class="dd-count">4 tools · IP, DNS, timestamps</div></div>
</a>
<a href="seo-tools">
<div class="dd-icon">SEO</div>
<div class="dd-info"><div class="dd-name">SEO & Meta Tools</div><div class="dd-count">3 tools · OG, meta, slug</div></div>
</a>
<div class="nav-dropdown-divider"></div>
<a class="dd-all" href="all-tools">
<div class="dd-icon">All</div>
<div class="dd-info"><div class="dd-name">Browse all 50 tools</div><div class="dd-count">Searchable catalog & categories</div></div>
</a>
</div>
</div>
<a href="/guides">Guides</a>
<a href="about">About</a>
<a href="privacy">Privacy</a>
</div>
</nav>
<div class="wrapper">
<section class="tool-header">
<a class="tool-back" href="/" aria-label="Back to home">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>
Back
</a>
<span class="tool-badge">Network</span>
<h1>HTTP Request Builder</h1>
<p>Compose HTTP calls visually — method, URL, headers, query, body — and copy the equivalent <code>curl</code>, <code>fetch</code>, <code>axios</code>, Python <code>requests</code>, or Node code. Send live to inspect status, headers, and body (subject to CORS). Runs in your browser.</p>
<div class="last-updated">Last updated: May 2026 · Written by <a href="/about">Anees Ur Rehman</a>, full-stack developer</div>
</section>
<div class="tool-card">
<div class="card-dots"><span></span><span></span><span></span></div>
<div class="tool-body">
<div class="rb-row">
<select id="rb-method">
<option>GET</option><option>POST</option><option>PUT</option><option>PATCH</option><option>DELETE</option><option>OPTIONS</option><option>HEAD</option>
</select>
<input type="text" class="rb-url" id="rb-url" value="https://api.github.com/repos/nodejs/node" placeholder="https://example.com/api" spellcheck="false" autocomplete="off">
</div>
<div class="rb-section">
<div class="rb-section-head"><h3>Headers</h3><button class="rb-add" onclick="addHeader()">+ Add header</button></div>
<div class="rb-quick">
<button onclick="quickHeader('Authorization','Bearer YOUR_TOKEN')">Authorization: Bearer</button>
<button onclick="quickHeader('Content-Type','application/json')">Content-Type: json</button>
<button onclick="quickHeader('Accept','application/json')">Accept: json</button>
<button onclick="quickHeader('User-Agent','devutils/1.0')">User-Agent</button>
</div>
<div id="rb-headers"></div>
</div>
<div class="rb-section">
<div class="rb-section-head"><h3>Query Parameters</h3><button class="rb-add" onclick="addParam()">+ Add param</button></div>
<div id="rb-params"></div>
</div>
<div class="rb-section rb-body" id="rb-body-section" style="display:none">
<div class="rb-section-head"><h3>Request Body</h3></div>
<textarea id="rb-body" placeholder='{"key":"value"}' spellcheck="false"></textarea>
<div class="rb-body-meta">
<label><input type="checkbox" id="rb-json-validate"> Validate JSON</label>
<span id="rb-json-status"></span>
</div>
</div>
<div class="rb-tabs">
<button class="rb-tab active" data-tab="curl">cURL</button>
<button class="rb-tab" data-tab="fetch">fetch()</button>
<button class="rb-tab" data-tab="axios">axios</button>
<button class="rb-tab" data-tab="python">Python requests</button>
<button class="rb-tab" data-tab="node">Node fetch</button>
</div>
<div class="rb-output">
<button class="rb-copy" onclick="copyOutput()">Copy</button>
<pre id="rb-out"></pre>
</div>
<button class="rb-send" id="rb-send">Send request</button>
<div id="rb-response" class="rb-response"></div>
<div class="rb-cors-note"><strong>CORS note:</strong> The browser only allows in-page requests when the target API sets permissive <code>Access-Control-Allow-Origin</code> headers. Internal or auth-protected APIs will usually fail with a CORS error — copy the generated cURL or Python code and run it from a terminal instead.</div>
</div>
</div>
<div id="toast" style="position:fixed;bottom:30px;left:50%;transform:translateX(-50%);background:var(--accent);color:#000;padding:8px 20px;border-radius:var(--radius);font-size:13px;font-weight:600;opacity:0;transition:opacity .3s;pointer-events:none;z-index:999">Copied!</div>
<p class="aeo-lead" style="font-size:16px;line-height:1.7;color:var(--text);max-width:760px;margin:24px auto 18px;padding:0 4px">
<strong>An HTTP request</strong> is a structured message sent from a client to a server, containing a method (GET, POST, PUT, DELETE), URL, headers, and optional body. Building requests manually is the foundation of API debugging and integration. This <strong>free browser-based HTTP request builder</strong> is a lightweight alternative to Postman for the 80% of cases where you just need to send one quick request and see the response.
</p>
<section id="examples" style="max-width:760px;margin:24px auto 32px">
<h2 style="font-size:18px;margin-bottom:14px">Examples</h2>
<div style="background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:12px">
<strong style="display:block;color:var(--accent);font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:1px;margin-bottom:6px">Quick GET with custom header§§GET /v1/users/123§§Authorization: Bearer eyJhbG...§§Common pattern for testing an authenticated endpoint without spinning up Postman.</strong>
</div>
<div style="background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:12px">
<strong style="display:block;color:var(--accent);font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:1px;margin-bottom:6px">POST with JSON body§§POST /api/orders§§Content-Type: application/json§§{ "product_id": 42, "quantity": 2 }§§The browser tool autofills Content-Type and Content-Length headers.</strong>
</div>
<div style="background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:12px">
<strong style="display:block;color:var(--accent);font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:1px;margin-bottom:6px">CORS limitation§§Requests from the browser to a different origin are subject to CORS. If you see "blocked by CORS policy", the target server is not allowing your browser origin — use curl or Postman desktop for CORS-restricted endpoints.</strong>
</div>
</section>
<aside class="founder-note" style="max-width:760px;margin:24px auto 32px;padding:20px 24px;background:rgba(0,208,132,0.05);border-left:3px solid var(--accent);border-radius:6px;font-size:14px;line-height:1.7;color:var(--text2)"><div style="font-family:var(--mono);font-size:11px;color:var(--accent);letter-spacing:1.5px;text-transform:uppercase;margin-bottom:10px;font-weight:600">💡 Why I built this</div><p style="margin:0 0 12px">I built this because Postman is genuinely great, but installing the desktop app to send three quick GET requests feels like overkill — especially on a customer’s machine where I cannot install software. This builder runs in browser, handles GET/POST/PUT/PATCH/DELETE/OPTIONS, supports custom headers, JSON body editor, and shows response with syntax highlighting. Perfect for the 80% of just-send-this-request moments.</p><p style="margin:0;font-size:13px;color:var(--text3)">— <a href="/about" style="color:var(--accent);text-decoration:none">Anees Ur Rehman</a>, full-stack developer</p></aside>
<section class="article-section">
<h2>HTTP requests in 2026 — methods, headers, status codes, and the API patterns that ship</h2>
<p>HTTP is the protocol layer every networked product runs on. Even when you are calling a "GraphQL API", a "gRPC service", or a "WebSocket endpoint", you are still riding HTTP/1.1, HTTP/2, or HTTP/3 underneath. Knowing the protocol cold pays off in every debugging session — every "why does this work in Postman but not in my code?" question, every CORS preflight mystery, every 401-when-it-should-be-403, every cached-response surprise. This guide is the working reference for the protocol fundamentals (RFC 9110), the headers that actually matter, the auth schemes that secure modern APIs, and the cURL → code patterns that live in every backend codebase.</p>
<h3>HTTP methods — what each one is for, and what's idempotent</h3>
<table class="ref-table">
<thead><tr><th>Method</th><th>Purpose</th><th>Body?</th><th>Safe?</th><th>Idempotent?</th></tr></thead>
<tbody>
<tr><td><code>GET</code></td><td>Read a resource</td><td>No (per RFC, ignored if present)</td><td>Yes</td><td>Yes</td></tr>
<tr><td><code>HEAD</code></td><td>Read headers only (no body)</td><td>No</td><td>Yes</td><td>Yes</td></tr>
<tr><td><code>POST</code></td><td>Create / non-idempotent action</td><td>Yes</td><td>No</td><td>No</td></tr>
<tr><td><code>PUT</code></td><td>Replace a resource at a known URL</td><td>Yes</td><td>No</td><td>Yes</td></tr>
<tr><td><code>PATCH</code></td><td>Partial update</td><td>Yes</td><td>No</td><td>No (typically)</td></tr>
<tr><td><code>DELETE</code></td><td>Remove a resource</td><td>Usually no</td><td>No</td><td>Yes</td></tr>
<tr><td><code>OPTIONS</code></td><td>Discover allowed methods, CORS preflight</td><td>No</td><td>Yes</td><td>Yes</td></tr>
<tr><td><code>CONNECT</code></td><td>Tunnel (proxies use this)</td><td>—</td><td>No</td><td>No</td></tr>
<tr><td><code>TRACE</code></td><td>Diagnostic loopback</td><td>No</td><td>Yes</td><td>Yes</td></tr>
</tbody>
</table>
<p>"Safe" means the request should not change server state. "Idempotent" means N identical requests have the same effect as one. These properties drive practical decisions:</p>
<ul>
<li><strong>Retry policies:</strong> safe to auto-retry GET, HEAD, PUT, DELETE on network errors. Don't auto-retry POST without an idempotency key.</li>
<li><strong>Caching:</strong> only safe methods can be cached. GET is the workhorse here.</li>
<li><strong>CSRF protection:</strong> only state-changing methods (POST, PUT, PATCH, DELETE) need CSRF tokens.</li>
</ul>
<h3>The headers you actually need to know</h3>
<table class="ref-table">
<thead><tr><th>Header</th><th>Direction</th><th>Purpose</th></tr></thead>
<tbody>
<tr><td><code>Content-Type</code></td><td>Both</td><td>What format the body is. <code>application/json</code>, <code>multipart/form-data</code>, <code>application/x-www-form-urlencoded</code>.</td></tr>
<tr><td><code>Accept</code></td><td>Request</td><td>What formats the client can handle. Most APIs only return one, but content-negotiation libraries respect it.</td></tr>
<tr><td><code>Authorization</code></td><td>Request</td><td><code>Bearer <token></code> for JWT/OAuth, <code>Basic <b64></code> for HTTP Basic.</td></tr>
<tr><td><code>User-Agent</code></td><td>Request</td><td>Identifies your client. Many APIs require it; some rate-limit by it.</td></tr>
<tr><td><code>Cache-Control</code></td><td>Both</td><td>Caching directives. <code>no-store</code>, <code>max-age=300</code>, <code>private</code>, <code>public</code>.</td></tr>
<tr><td><code>ETag</code> / <code>If-None-Match</code></td><td>Both</td><td>Conditional requests; server returns 304 Not Modified.</td></tr>
<tr><td><code>Last-Modified</code> / <code>If-Modified-Since</code></td><td>Both</td><td>Same idea, timestamp-based.</td></tr>
<tr><td><code>Idempotency-Key</code></td><td>Request</td><td>Stripe, Square, Square Cash all support — safe POST retries.</td></tr>
<tr><td><code>X-Request-Id</code> / <code>traceparent</code></td><td>Both</td><td>Distributed-tracing correlation. Echo it back in logs.</td></tr>
<tr><td><code>Access-Control-*</code></td><td>Response</td><td>CORS headers. Server-controlled; clients read them.</td></tr>
<tr><td><code>Content-Encoding</code></td><td>Response</td><td><code>gzip</code>, <code>br</code> (Brotli), <code>zstd</code>. The server has compressed the body.</td></tr>
<tr><td><code>Set-Cookie</code></td><td>Response</td><td>Set a cookie. <code>HttpOnly; Secure; SameSite=Lax</code> are the defaults you want.</td></tr>
</tbody>
</table>
<h3>Status code groups — which ones mean what</h3>
<table class="ref-table">
<thead><tr><th>Range</th><th>Class</th><th>Examples</th></tr></thead>
<tbody>
<tr><td>1xx</td><td>Informational</td><td>100 Continue, 101 Switching Protocols (WebSocket upgrade)</td></tr>
<tr><td>2xx</td><td>Success</td><td>200 OK, 201 Created, 202 Accepted (async), 204 No Content</td></tr>
<tr><td>3xx</td><td>Redirection</td><td>301 Permanent, 302 Found (temp), 304 Not Modified, 308 Permanent (preserve method)</td></tr>
<tr><td>4xx</td><td>Client error</td><td>400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Unprocessable, 429 Too Many Requests</td></tr>
<tr><td>5xx</td><td>Server error</td><td>500 Internal, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout</td></tr>
</tbody>
</table>
<p>Two distinctions every junior dev gets wrong:</p>
<ul>
<li><strong>401 vs 403:</strong> 401 means "you didn't authenticate" (no/invalid token); 403 means "you authenticated but you can't access this".</li>
<li><strong>302 vs 307 vs 308:</strong> 302 historically allowed clients to change POST→GET on redirect; 307/308 explicitly preserve the method. Use 308 for permanent redirects of POST endpoints.</li>
</ul>
<h3>Authentication schemes — JWT, OAuth, API key, HMAC, mTLS</h3>
<p>Picking auth correctly the first time saves a rewrite later. For browser-facing APIs, Bearer JWTs (issued via OAuth 2.0 PKCE) are the modern default — short-lived access tokens with refresh tokens stored in <code>HttpOnly</code> cookies. For server-to-server, API keys with rotation or HMAC request-signing are simpler. To inspect or mint a Bearer token while you're testing here, the <a href="/jwt-decoder">JWT decoder</a> shows the payload claims and the <a href="/jwt-generator">JWT generator</a> mints signed test tokens with HS256/RS256/ES256.</p>
<table class="ref-table">
<thead><tr><th>Scheme</th><th>Header</th><th>Use for</th></tr></thead>
<tbody>
<tr><td>Bearer (JWT / OAuth)</td><td><code>Authorization: Bearer <token></code></td><td>Modern APIs; standard.</td></tr>
<tr><td>HTTP Basic</td><td><code>Authorization: Basic base64(user:pass)</code></td><td>Internal services, dev tools. Requires HTTPS.</td></tr>
<tr><td>API Key (header)</td><td><code>X-API-Key: ...</code> or custom</td><td>Server-to-server. Rotate regularly.</td></tr>
<tr><td>API Key (query param)</td><td><code>?api_key=...</code></td><td>Avoid — leaks into logs and Referer headers.</td></tr>
<tr><td>HMAC (request signing)</td><td><code>Authorization: AWS4-HMAC-SHA256 ...</code></td><td>AWS, Cloudflare, anywhere replay-protection matters.</td></tr>
<tr><td>Mutual TLS (mTLS)</td><td>Client cert</td><td>Service-to-service in zero-trust networks.</td></tr>
<tr><td>Cookies (Set-Cookie)</td><td>Implicit on every request</td><td>Browser-based apps; pair with CSRF tokens.</td></tr>
</tbody>
</table>
<h3>CORS — the browser policy that confuses everyone</h3>
<p>The Same-Origin Policy stops a page on <code>evil.com</code> from reading responses from <code>bank.com</code>. CORS is the carve-out: a server can opt-in to allow specific cross-origin requests. The flow:</p>
<ol>
<li><strong>Simple requests</strong> (GET/HEAD/POST with simple Content-Type) — browser sends the request directly. Server responds with <code>Access-Control-Allow-Origin: <origin></code> or <code>*</code>.</li>
<li><strong>Preflighted requests</strong> (PUT, DELETE, custom headers, JSON body) — browser sends an <code>OPTIONS</code> preflight first. Server must respond with <code>Access-Control-Allow-Methods</code>, <code>Access-Control-Allow-Headers</code>, and <code>Access-Control-Allow-Origin</code>.</li>
<li><strong>Credentialed requests</strong> (cookies, Authorization header, client certs) — server must respond with <code>Access-Control-Allow-Credentials: true</code> AND a specific origin (not <code>*</code>).</li>
</ol>
<p>The single biggest debugging tip: <strong>CORS errors only happen in browsers</strong>. The same request from cURL, Postman, or your Node backend works fine. If your browser request fails but cURL succeeds, it's CORS — fix the server.</p>
<h3>cURL — the lingua franca of API debugging</h3>
<p>The cURL output is the de-facto sharing format. Common flags:</p>
<pre><code>curl -X POST https://api.example.com/users \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"email":"alice@example.com","name":"Alice"}' \
-i # include response headers
-v # verbose: show request & response in detail
-L # follow redirects
-s # silent (no progress bar)
-w "%{http_code}\n" # write out specific values
--fail-with-body # exit non-zero on 4xx/5xx but still print body
--resolve api.example.com:443:127.0.0.1 # bypass DNS for local testing</code></pre>
<h3>HTTP/1.1 vs HTTP/2 vs HTTP/3 — what changes</h3>
<ul>
<li><strong>HTTP/1.1 (1997):</strong> Text protocol. One in-flight request per connection (or pipelining, which never worked reliably). Requires multiple TCP connections to parallelize.</li>
<li><strong>HTTP/2 (2015):</strong> Binary, multiplexed. Multiple streams over a single TLS connection. Header compression (HPACK). Server push (deprecated 2022).</li>
<li><strong>HTTP/3 (2022):</strong> Built on QUIC over UDP instead of TCP. No head-of-line blocking. Faster connection setup. Production-ready in Cloudflare, Akamai, Fastly, Google.</li>
</ul>
<p>For most APIs, HTTP/2 is the default, HTTP/3 is the upgrade path. From the application code's perspective the API is identical — you write <code>fetch()</code> or <code>requests.get()</code> the same way. Performance differences show up in p99 latency and concurrent-request scenarios.</p>
<h3>Idempotency keys — the pattern that makes retries safe</h3>
<p>Stripe, Square, Adyen, Paddle, and every modern payments API support idempotency keys. The client sends a unique key with the POST; the server stores the response keyed by that key. If the client retries (because the network dropped, or the server timed out), the server returns the cached response instead of double-charging. The pattern:</p>
<pre><code>POST /charges HTTP/1.1
Idempotency-Key: 09cb3b3f-6e7f-4bba-8a4d-5d07c5b2c91a
Content-Type: application/json
{"amount": 1000, "currency": "usd"}</code></pre>
<p>Use a UUID v4 generated once per logical operation. Don't reuse a key across distinct operations or you'll get the cached response from the previous one.</p>
<h3>Common HTTP-request mistakes</h3>
<ul>
<li><strong>Putting API keys in query strings.</strong> Leaks into server logs, browser history, and Referer headers. Use the <code>Authorization</code> header.</li>
<li><strong>Not setting <code>Content-Type</code> on POST/PUT.</strong> Server can't parse the body. <code>application/json</code> is the right answer 95% of the time.</li>
<li><strong>Treating 200 as success and everything else as failure.</strong> 201, 202, 204 are also success. Check <code>2xx</code> generally.</li>
<li><strong>Not handling 429 (rate limit).</strong> Servers return <code>Retry-After</code> in the response — wait that long before retrying.</li>
<li><strong>Auto-retrying POST without idempotency key.</strong> You can charge a customer twice.</li>
<li><strong>Forgetting to follow redirects.</strong> 3xx responses need to be followed; some clients don't by default.</li>
<li><strong>Using cookies on a third-party API.</strong> Modern browsers reject third-party cookies by default. Use Authorization headers.</li>
<li><strong>Confusing <code>application/json</code> with <code>application/x-www-form-urlencoded</code>.</strong> Different body formats; the server cares which.</li>
<li><strong>Sending the body as a string when the server expects JSON.</strong> Stringify with <code>JSON.stringify()</code> in JS, but make sure the receiver parses it.</li>
<li><strong>Pasting curl from DevTools without removing cookies/auth.</strong> Right-click → "Copy as cURL" includes session cookies that expire — strip them or replace with explicit auth headers before sharing.</li>
</ul>
<aside class="article-aside">
<strong>Authoritative references:</strong>
<ul>
<li><a href="https://datatracker.ietf.org/doc/html/rfc9110" rel="noopener" target="_blank">RFC 9110 — HTTP Semantics (the modern HTTP spec)</a></li>
<li><a href="https://datatracker.ietf.org/doc/html/rfc9112" rel="noopener" target="_blank">RFC 9112 — HTTP/1.1</a></li>
<li><a href="https://datatracker.ietf.org/doc/html/rfc9114" rel="noopener" target="_blank">RFC 9114 — HTTP/3 (over QUIC)</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" rel="noopener" target="_blank">MDN — CORS reference</a></li>
<li><a href="https://stripe.com/docs/api/idempotent_requests" rel="noopener" target="_blank">Stripe — Idempotency keys documentation</a></li>
<li><a href="https://curl.se/docs/manual.html" rel="noopener" target="_blank">cURL — official manual</a></li>
</ul>
</aside>
</section>
<section class="faq-section">
<h2>Frequently Asked Questions</h2>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">What is an HTTP request builder?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">An <strong>HTTP request builder</strong> is a visual tool for constructing HTTP requests — pick a method, type a URL, add headers and query params, paste a body — and see the equivalent code in multiple languages. It's the lightweight cousin of Postman or Insomnia: handy when you just need a quick curl snippet, want to show a colleague exactly what request you sent, or need to turn a working browser DevTools request into production code without hand-editing escape sequences.</div></div>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">What code formats does this tool generate?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">Five outputs are generated live on every keystroke: <strong>cURL</strong> with proper single-quote escaping and <code>\</code> line continuations for readability, browser <strong>fetch()</strong>, <strong>axios</strong>, <strong>Python requests</strong> (using <code>json=</code> when Content-Type is JSON, <code>data=</code> otherwise), and <strong>Node fetch</strong>. Each tab has its own copy button, so moving code into a script, notebook, or CI job takes a single click.</div></div>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">Why does sending the request fail with a CORS error?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">Browsers enforce the <strong>Same-Origin Policy</strong>: cross-origin <code>fetch()</code> calls only succeed when the target server responds with a permissive <code>Access-Control-Allow-Origin</code> header (and handles the CORS pre-flight for non-simple requests). Most internal or authenticated APIs don't, so the browser blocks the response — not because the server is down, but because the browser refuses to expose it. CORS only restricts browser JavaScript. Copy the generated <strong>cURL</strong>, <strong>Python</strong>, or <strong>Node</strong> snippet and run it from a terminal to bypass CORS entirely.</div></div>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">Does this tool store or log my requests?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">No. The entire builder runs in your browser — code generation is local JavaScript, and when you click <strong>Send request</strong> the call goes directly from your browser to the target URL. Nothing is proxied through this site. That said, use caution: anything you paste into the tool stays in your browser tab's memory until you close it, so avoid pasting long-lived production API keys or customer-specific bearer tokens into any online builder (including this one).</div></div>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">How do I send a JSON body?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">Switch the method to POST, PUT, or PATCH, click the <strong>Content-Type: application/json</strong> quick-add button, and paste your JSON into the body textarea. Enable <strong>Validate JSON</strong> to confirm the syntax before sending — the label will turn green when the body parses cleanly. The generated cURL output will quote the body safely with single quotes and escape any internal single quotes using the <code>'\''</code> pattern. Python output automatically switches to <code>json=</code> so <code>requests</code> serializes the payload and sets <code>Content-Type</code> for you.</div></div>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">Why do GET and HEAD requests not show a body field?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">Per RFC 9110, <strong>GET</strong>, <strong>HEAD</strong>, <strong>DELETE</strong> (usually), and <strong>OPTIONS</strong> requests should not carry a message body — their semantics are defined by the URL and headers alone. Some servers technically accept a body on GET, but browsers, proxies, and caches may strip it, so it's unreliable. The tool hides the body field for GET/HEAD to match common practice; if you need to send a payload with DELETE for a specific API (Elasticsearch uses this pattern), paste it while on POST or PUT first, then switch the method — the body persists.</div></div>
<div class="faq-item"><div class="faq-q" onclick="toggleFaq(this)">How are query parameters encoded?<svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg></div><div class="faq-a">Query params are assembled using <code>URLSearchParams</code> semantics (the same rules the built-in <code>URL</code> object applies), so spaces become <code>+</code>, reserved characters are percent-encoded, and duplicate keys produce repeated parameters (<code>?tag=a&tag=b</code>) — the standard way most APIs expect array-valued params. If your URL already contains a query string, the new params are appended with <code>&</code> instead of <code>?</code>.</div></div>
</section>
<section class="related-section">
<h2>Related Tools</h2>
<div class="related-grid">
<a class="related-card" href="http-status"><div class="related-icon">200</div><div class="related-card-info"><div class="related-card-name">HTTP Status Codes</div><div class="related-card-desc">Reference for every HTTP code</div></div></a>
<a class="related-card" href="jwt-decoder"><div class="related-icon">JWT</div><div class="related-card-info"><div class="related-card-name">JWT Decoder</div><div class="related-card-desc">Decode bearer tokens</div></div></a>
<a class="related-card" href="url-encoder"><div class="related-icon">%20</div><div class="related-card-info"><div class="related-card-name">URL Encoder</div><div class="related-card-desc">Encode and decode URIs</div></div></a>
</div>
</section>
<section class="all-tools-section" aria-label="Browse all FreeDevTool developer tools">
<h2>Browse all 50 free developer tools</h2>
<p class="atc-sub">All tools run in your browser, no signup required, nothing sent to a server.</p>
<div class="all-tools-grid">
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">b64</div>
<div class="atc-cat-title"><h3>Encoding & Conversion</h3><span class="atc-cat-count">11 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/base64-encoder">Base64 Encoder / Decoder</a></li>
<li><a href="/base64-image">Image to Base64</a></li>
<li><a href="/byte-converter">Byte Converter (KB / MB / GB)</a></li>
<li><a href="/case-converter">Case Converter</a></li>
<li><a href="/hex-to-rgb">Hex to RGB / HSL</a></li>
<li><a href="/html-entity">HTML Entity Encoder</a></li>
<li><a href="/json-to-csv">JSON to CSV Converter</a></li>
<li><a href="/px-to-rem">PX to REM Converter</a></li>
<li><a href="/string-escape">String Escape / Unescape</a></li>
<li><a href="/url-encoder">URL Encoder / Decoder</a></li>
<li><a href="/yaml-to-json">YAML to JSON Converter</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">{ }</div>
<div class="atc-cat-title"><h3>Formatting & Generators</h3><span class="atc-cat-count">13 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/color-name">Color Name from Hex</a></li>
<li><a href="/color-picker">Color Palette Picker</a></li>
<li><a href="/css-box-shadow">CSS Box Shadow</a></li>
<li><a href="/css-gradient">CSS Gradient Generator</a></li>
<li><a href="/json-formatter">JSON Formatter / Validator</a></li>
<li><a href="/lorem-ipsum">Lorem Ipsum Generator</a></li>
<li><a href="/markdown-preview">Markdown Preview</a></li>
<li><a href="/password-generator">Password Generator</a></li>
<li><a href="/qr-generator">QR Code Generator</a></li>
<li><a href="/sql-formatter">SQL Formatter</a></li>
<li><a href="/uuid-generator">UUID Generator</a></li>
<li><a href="/word-to-markdown">Word to Markdown</a></li>
<li><a href="/xml-formatter">XML Formatter</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">JS</div>
<div class="atc-cat-title"><h3>Minifiers & DevOps</h3><span class="atc-cat-count">6 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/chmod-calculator">chmod Calculator</a></li>
<li><a href="/cron-parser">Cron Expression Parser</a></li>
<li><a href="/css-minifier">CSS Minifier</a></li>
<li><a href="/html-minifier">HTML Minifier</a></li>
<li><a href="/js-minifier">JavaScript Minifier</a></li>
<li><a href="/http-status">HTTP Status Codes</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">#</div>
<div class="atc-cat-title"><h3>Security & Hashing</h3><span class="atc-cat-count">3 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/hash-generator">Hash Generator (MD5, SHA)</a></li>
<li><a href="/jwt-decoder">JWT Decoder</a></li>
<li><a href="/jwt-generator">JWT Generator</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">.*</div>
<div class="atc-cat-title"><h3>Code & Text</h3><span class="atc-cat-count">8 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/ai-token-counter">AI Token Counter</a></li>
<li><a href="/char-counter">Character & Word Counter</a></li>
<li><a href="/git-cheatsheet">Git Commands Cheatsheet</a></li>
<li><a href="/number-base">Number Base Converter</a></li>
<li><a href="/regex-explainer">Regex Explainer</a></li>
<li><a href="/regex-tester">Regex Tester</a></li>
<li><a href="/text-diff">Text Diff Checker</a></li>
<li><a href="/wcag-contrast">WCAG Contrast Checker</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">IP</div>
<div class="atc-cat-title"><h3>Network & APIs</h3><span class="atc-cat-count">3 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/dns-lookup">DNS Lookup</a></li>
<li><a href="/http-request-builder">HTTP Request Builder</a></li>
<li><a href="/ip-lookup">IP Address Lookup</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">⏱</div>
<div class="atc-cat-title"><h3>Time & Dates</h3><span class="atc-cat-count">3 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/relative-time">Relative Time Calculator</a></li>
<li><a href="/timestamp-diff">Timestamp Diff</a></li>
<li><a href="/unix-timestamp-converter">Unix Timestamp Converter</a></li>
</ul>
</div>
<div class="atc-cat">
<div class="atc-cat-head">
<div class="atc-cat-icon">SEO</div>
<div class="atc-cat-title"><h3>SEO & Meta</h3><span class="atc-cat-count">3 tools</span></div>
</div>
<ul class="atc-list">
<li><a href="/meta-tag-generator">Meta Tag Generator</a></li>
<li><a href="/og-preview">Open Graph Preview</a></li>
<li><a href="/slug-generator">URL Slug Generator</a></li>
</ul>
</div>
</div>
</section>
</div>
<footer>
<div>© 2026 FreeDevTool. Built for developers, by developers.</div>
<div class="footer-links"><a href="/all-tools">All Tools</a><a href="/about">About</a><a href="/privacy">Privacy Policy</a><a href="/terms">Terms of Use</a></div>
</footer>
<script>
const METHODS_WITH_BODY=new Set(['POST','PUT','PATCH']);
let currentTab='curl';
function addHeader(name='',value=''){
const wrap=document.getElementById('rb-headers');
const row=document.createElement('div');
row.className='rb-kv';
row.innerHTML='<input type="text" placeholder="Header name" class="rb-h-name"><input type="text" placeholder="Value" class="rb-h-val"><button title="Remove">x</button>';
row.querySelector('.rb-h-name').value=name;
row.querySelector('.rb-h-val').value=value;
row.querySelector('button').onclick=()=>{row.remove();update();};
row.querySelectorAll('input').forEach(i=>i.addEventListener('input',update));
wrap.appendChild(row);
update();
}
function addParam(name='',value=''){
const wrap=document.getElementById('rb-params');
const row=document.createElement('div');
row.className='rb-kv';
row.innerHTML='<input type="text" placeholder="Param name" class="rb-p-name"><input type="text" placeholder="Value" class="rb-p-val"><button title="Remove">x</button>';
row.querySelector('.rb-p-name').value=name;
row.querySelector('.rb-p-val').value=value;
row.querySelector('button').onclick=()=>{row.remove();update();};
row.querySelectorAll('input').forEach(i=>i.addEventListener('input',update));
wrap.appendChild(row);
update();
}
function quickHeader(name,value){
const rows=document.querySelectorAll('#rb-headers .rb-kv');
for(const r of rows){
if(r.querySelector('.rb-h-name').value.toLowerCase()===name.toLowerCase()){
r.querySelector('.rb-h-val').value=value;
update();
return;
}
}
addHeader(name,value);
}
function gatherState(){
const method=document.getElementById('rb-method').value;
const rawUrl=document.getElementById('rb-url').value.trim();
const body=document.getElementById('rb-body').value;
const headers=[];
document.querySelectorAll('#rb-headers .rb-kv').forEach(r=>{
const n=r.querySelector('.rb-h-name').value.trim();
const v=r.querySelector('.rb-h-val').value;
if(n)headers.push([n,v]);
});
const params=[];
document.querySelectorAll('#rb-params .rb-kv').forEach(r=>{
const n=r.querySelector('.rb-p-name').value.trim();
const v=r.querySelector('.rb-p-val').value;
if(n)params.push([n,v]);
});
let url=rawUrl;
if(params.length){
const usp=new URLSearchParams();
params.forEach(([k,v])=>usp.append(k,v));
url+=(url.includes('?')?'&':'?')+usp.toString();
}
const hasBody=METHODS_WITH_BODY.has(method)&&body.length>0;
return{method,url,rawUrl,headers,params,body,hasBody};
}
function shellSingleQuote(s){return "'"+String(s).replace(/'/g,"'\\''")+"'";}
function jsString(s){return JSON.stringify(String(s));}
function pyString(s){
return "'"+String(s).replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/\n/g,'\\n').replace(/\r/g,'\\r')+"'";
}
function genCurl(s){
const parts=['curl -X '+s.method+' '+shellSingleQuote(s.url)];
s.headers.forEach(([n,v])=>parts.push(' -H '+shellSingleQuote(n+': '+v)));
if(s.hasBody)parts.push(' --data '+shellSingleQuote(s.body));
return parts.join(' \\\n');
}
function genFetch(s){
const opts={method:s.method};
if(s.headers.length)opts.headers=Object.fromEntries(s.headers);
if(s.hasBody)opts.body=s.body;
return'fetch('+jsString(s.url)+', '+JSON.stringify(opts,null,2)+')\n .then(r => r.text())\n .then(console.log)\n .catch(console.error);';
}
function genAxios(s){
const cfg={method:s.method.toLowerCase(),url:s.url};
if(s.headers.length)cfg.headers=Object.fromEntries(s.headers);
if(s.hasBody){
const ct=(s.headers.find(([n])=>n.toLowerCase()==='content-type')||[])[1]||'';
if(/json/i.test(ct)){
try{cfg.data=JSON.parse(s.body);}catch{cfg.data=s.body;}
}else{cfg.data=s.body;}
}
return'axios('+JSON.stringify(cfg,null,2)+')\n .then(r => console.log(r.data))\n .catch(console.error);';
}
function genPython(s){
const lines=['import requests',''];
if(s.headers.length){
lines.push('headers = {');
s.headers.forEach(([n,v])=>lines.push(' '+pyString(n)+': '+pyString(v)+','));
lines.push('}');
}
const ct=(s.headers.find(([n])=>n.toLowerCase()==='content-type')||[])[1]||'';
const args=[' '+pyString(s.url)];
if(s.headers.length)args.push(' headers=headers');
if(s.hasBody){
if(/json/i.test(ct)){
try{JSON.parse(s.body);args.push(' json='+pyToJson(s.body));}
catch{args.push(' data='+pyString(s.body));}
}else{args.push(' data='+pyString(s.body));}
}
lines.push('');
lines.push('resp = requests.'+s.method.toLowerCase()+'(');
lines.push(args.join(',\n'));
lines.push(')');
lines.push('print(resp.status_code)');
lines.push('print(resp.text)');
return lines.join('\n');
}
function pyToJson(body){
try{
const parsed=JSON.parse(body);
return JSON.stringify(parsed,null,4).replace(/^/gm,' ').trimStart().replace(/: true/g,': True').replace(/: false/g,': False').replace(/: null/g,': None');
}catch{return pyString(body);}
}
function genNode(s){
const opts={method:s.method};
if(s.headers.length)opts.headers=Object.fromEntries(s.headers);
if(s.hasBody)opts.body=s.body;
return"// Requires Node 18+\nconst resp = await fetch("+jsString(s.url)+", "+JSON.stringify(opts,null,2)+");\nconsole.log(resp.status);\nconsole.log(await resp.text());";
}
function update(){
const s=gatherState();
const bodySection=document.getElementById('rb-body-section');
bodySection.style.display=METHODS_WITH_BODY.has(s.method)?'':'none';
let out='';
if(currentTab==='curl')out=genCurl(s);
else if(currentTab==='fetch')out=genFetch(s);
else if(currentTab==='axios')out=genAxios(s);
else if(currentTab==='python')out=genPython(s);
else if(currentTab==='node')out=genNode(s);
document.getElementById('rb-out').textContent=out;
validateJson();
}
function validateJson(){
const cb=document.getElementById('rb-json-validate');
const status=document.getElementById('rb-json-status');
if(!cb.checked){status.textContent='';return;}
const body=document.getElementById('rb-body').value;
if(!body.trim()){status.textContent='';return;}
try{JSON.parse(body);status.textContent='Valid JSON';status.className='valid';}
catch(e){status.textContent='Invalid: '+e.message;status.className='invalid';}
}
function copyOutput(){
navigator.clipboard.writeText(document.getElementById('rb-out').textContent);
const t=document.getElementById('toast');t.style.opacity='1';setTimeout(()=>t.style.opacity='0',1500);
}
document.querySelectorAll('.rb-tab').forEach(btn=>{
btn.addEventListener('click',()=>{
document.querySelectorAll('.rb-tab').forEach(b=>b.classList.remove('active'));
btn.classList.add('active');
currentTab=btn.dataset.tab;
update();
});
});
document.getElementById('rb-method').addEventListener('change',update);
document.getElementById('rb-url').addEventListener('input',update);
document.getElementById('rb-body').addEventListener('input',update);
document.getElementById('rb-json-validate').addEventListener('change',validateJson);
document.getElementById('rb-send').addEventListener('click',async()=>{
const s=gatherState();
const btn=document.getElementById('rb-send');
const box=document.getElementById('rb-response');
btn.disabled=true;btn.textContent='Sending...';
box.className='rb-response show';
box.innerHTML='<div class="rb-resp-status">Sending request...</div>';
const started=performance.now();
try{
const opts={method:s.method,headers:Object.fromEntries(s.headers)};
if(s.hasBody)opts.body=s.body;
const resp=await fetch(s.url,opts);
const elapsed=Math.round(performance.now()-started);
const hdrLines=[];
resp.headers.forEach((v,k)=>hdrLines.push(k+': '+v));
const text=await resp.text();
let pretty=text;
try{pretty=JSON.stringify(JSON.parse(text),null,2);}catch{}
const cls=resp.ok?'ok':'err';
box.innerHTML='<div class="rb-resp-status '+cls+'">'+resp.status+' '+escapeHtml(resp.statusText)+' — '+elapsed+' ms</div><div class="rb-resp-headers">'+escapeHtml(hdrLines.join('\n'))+'</div><div class="rb-resp-body">'+escapeHtml(pretty)+'</div>';
}catch(e){
box.innerHTML='<div class="rb-resp-status err">Request failed: '+escapeHtml(e.message||String(e))+'</div><div class="rb-resp-headers">Likely a CORS restriction. Try the generated cURL or Python snippet from a terminal.</div>';
}finally{
btn.disabled=false;btn.textContent='Send request';
}
});
function escapeHtml(s){return String(s).replace(/[&<>"']/g,c=>({"&":"&","<":"<",">":">","\"":""","'":"'"}[c]));}
addHeader('Accept','application/json');
update();
function toggleFaq(el){el.parentElement.classList.toggle('open');}
</script>
</body>
</html>