Skip to content

📡 request-mock-skillsMock HTTP Capture Results

Build requests from parameters or templates, produce HAR captures, and export to curl / wget / python / postman / xml / yaml / har / jsonl / csv / markdown / html / text.

Quick Start ​

bash
# Install
go install github.com/cyberspacesec/request-mock-skills/cmd/request-mock@latest

# Generate one request → JSON envelope (AI-friendly)
request-mock generate -X POST -u https://api.example.com/login -d '{"u":"a"}' -f json

# Batch derivation, deterministic
request-mock generate -X GET -u https://api.example.com/users -n 50 --seed 42 -f jsonl

# Raw curl output
request-mock generate -X GET -u https://api.example.com/users -f curl --raw

SDK Example ​

go
package main

import (
    "fmt"
    "github.com/cyberspacesec/request-mock-skills/pkg/mock"
)

func main() {
    spec := mock.Login("https://api.example.com/login", "alice", "secret")
    h, _ := mock.GenerateOne(spec)
    curl, _ := mock.Export(h, mock.FormatCurl)
    fmt.Println(curl)
}

Data Flow ​

mermaid
flowchart LR
    A["Parameters / Templates"] --> B["RequestSpec"]
    B --> C["Generate"]
    C --> D["*har.Har"]
    D --> E["Export"]
    E --> F1["curl / wget / python"]
    E --> F2["postman / xml / yaml"]
    E --> F3["har / jsonl / csv"]
    E --> F4["markdown / html / text"]
    D -.optional.-> P["Split / Dedup / AddHeaders / Clone"]
    P --> E

Key Features ​

  • Deterministic — same seed + same input → same output
  • 16 transforms — server IP, user-agent, path, query noise, status, timings, …
  • 20+ scenario templates — login, upload, banner, redirect, error, portscan, …
  • 12 export formats — curl, wget, python, postman, xml, yaml, har/json, jsonl, csv, markdown, html, text
  • HAR post-processing — split (6 dimensions), dedup, add-headers, clone
  • AI-friendly CLI — structured JSON envelope by default, --raw for humans
  • Config-driven — YAML/JSON batch config
  • Request chains — causal request sequences with auto-injection

Released under the MIT License.