Parse and transform copied HTTP requests into clean, reusable code.
reqparser helps you take copied network requests from browser DevTools or curl, normalize them into a structured request shape, and generate cleaner output for use in code, scripts, or debugging.
It is built for developers who want to stop manually rewriting copied requests into axios, fetch, curl, or JSON.
-
Parse copied
fetch(...)requests -
Parse copied
curlcommands -
Generate clean output as:
axiosfetchcurljson
-
Detect request input type
-
Validate parsed requests
-
Optionally redact sensitive headers
-
Use from the CLI or extend the codebase further
Examples of supported fetch input:
fetch("https://api.example.com/users", {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({ id: 1, name: "Ayodele" }),
});Examples of supported curl input:
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"id":1,"name":"Ayodele"}'You can generate any of the following:
axiosfetchcurljson
Copied network requests are useful, but usually messy.
A request copied from DevTools or a terminal often contains formatting noise, inconsistent headers, escaped body strings, and other details that make it annoying to reuse directly in code.
reqparser is designed to make that workflow easier:
- copy a request
- parse it
- turn it into something cleaner and reusable
Clone the repo and install dependencies:
pnpm installRun locally in development mode:
pnpm devBuild the project:
pnpm buildRun tests:
pnpm testThe CLI currently exposes three commands:
detectparsevalidate
pnpm dev detect --file test.txtOr from stdin:
cat test.txt | pnpm dev detect --stdinGenerate axios:
pnpm dev parse --file test.txt --to axiosGenerate fetch:
pnpm dev parse --file test.txt --to fetchGenerate curl:
pnpm dev parse --file test.txt --to curlGenerate normalized JSON:
pnpm dev parse --file test.txt --to jsonWrite output to a file:
pnpm dev parse --file test.txt --to axios --out output.tsRedact sensitive headers before generation:
pnpm dev parse --file test_curl.txt --to json --redactpnpm dev validate --file test.txtfetch("https://api.example.com/users", {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({ id: 1, name: "Ayodele" }),
});const response = await axios({
url: "https://api.example.com/users",
method: "post",
headers: {
"content-type": "application/json",
},
data: '{"id":1,"name":"Ayodele"}',
});curl -X POST https://api.stripe.com/v1/charges \
-H "Authorization: Bearer sk_test_123" \
-H "Content-Type: application/json" \
-d '{"amount":2000}'{
"url": "https://api.stripe.com/v1/charges",
"method": "POST",
"headers": {
"authorization": "Bearer sk_test_123",
"content-type": "application/json"
},
"body": {
"raw": "{\"amount\":2000}",
"json": {
"amount": 2000
},
"type": "json"
},
"meta": {
"source": "curl",
"warnings": []
}
}reqparser is in an early but working stage.
The current architecture is already in place, including:
- CLI commands
- input detection
- fetch parsing
- curl parsing
- output generation
- basic tests
The parser support is still being hardened for more real-world request shapes and edge cases.
src/
cli/
core/
generators/
parsers/
utils/
tests/
src/clicontains the command-line interfacesrc/corecontains shared types, detection, and engine flowsrc/parserscontains request parsers for different input formatssrc/generatorscontains output generatorssrc/utilscontains helper logic like redactiontestscontains test coverage
Install dependencies:
pnpm installRun in development:
pnpm dev parse --file test.txt --to jsonRun tests:
pnpm testWatch tests:
pnpm test:watchPlanned improvements include:
- stronger fetch body parsing
- more complete curl parsing coverage
- optional redaction only at CLI generation stage
- better validation warnings
- fixture-based parser tests
- improved formatting of generated code
- package publishing
- future reusable engine API beyond the CLI
Issues and pull requests are welcome.
If you want to contribute, please:
- open an issue describing the bug or feature
- keep changes focused and small where possible
- add tests for parser or generator changes
- avoid breaking existing CLI behavior without documenting it
MIT