httpcan-0.1.0 is not a library.
Visit the last successful build:
httpcan-0.5.2
HTTPCan
A simple HTTP request & response service built with Rust and Actix Web, with httpbin compatibility.
Features
- HTTPBin Compatible - Full compatibility with httpbin API for seamless migration and testing
- AI-Era Streaming - Native support for SSE and NDJSON endpoints with OpenAI/Ollama format compatibility
- Tiny Docker Image - Less than 10MB image size for fast deployment
- Minimal Memory Footprint - Extremely low memory usage for efficient resource utilization
- High Throughput - Built with Rust and async I/O for maximum performance
This server implements the HTTPBin API with the following endpoints:
HTTP Methods
GET /get- Returns request data for GET requestsPOST /post- Returns request data for POST requestsPUT /put- Returns request data for PUT requestsPATCH /patch- Returns request data for PATCH requestsDELETE /delete- Returns request data for DELETE requests
Anything Endpoints (Multiple HTTP Methods)
/anything- Accepts GET, POST, PUT, PATCH, DELETE, TRACE/anything/{anything}- Same as above with path parameter
Authentication
GET /basic-auth/{user}/{passwd}- Basic authenticationGET /hidden-basic-auth/{user}/{passwd}- Basic auth with 404 on failureGET /bearer- Bearer token authenticationGET /digest-auth/{qop}/{user}/{passwd}- Digest authenticationGET /digest-auth/{qop}/{user}/{passwd}/{algorithm}- Digest auth with algorithmGET /digest-auth/{qop}/{user}/{passwd}/{algorithm}/{stale_after}- Full digest auth
Response Formats
GET /json- Returns JSON responseGET /xml- Returns XML responseGET /html- Returns HTML responseGET /robots.txt- Returns robots.txtGET /deny- Returns denied messageGET /encoding/utf8- Returns UTF-8 encoded responseGET /gzip- Returns gzip-compressed responseGET /deflate- Returns deflate-compressed responseGET /brotli- Returns brotli-compressed response
Dynamic Data
GET /uuid- Returns a UUID4GET /base64/{value}- Decodes base64-encoded stringGET /bytes/{n}- Returns n random bytesGET /stream-bytes/{n}- Streams n random bytesGET /stream/{n}- Streams n JSON responsesGET /range/{numbytes}- Returns bytes with range supportGET /links/{n}/{offset}- Returns page with n linksGET /drip- Drips data over time/delay/{delay}- Returns delayed response (supports multiple methods)
Redirects
GET /redirect/{n}- 302 redirects n timesGET /relative-redirect/{n}- Relative 302 redirects n timesGET /absolute-redirect/{n}- Absolute 302 redirects n times/redirect-to- 302 redirects to given URL (supports multiple methods)
Request Inspection
GET /headers- Returns request headersGET /ip- Returns client IP addressGET /user-agent- Returns User-Agent header
Response Inspection
GET /cache- Returns 304 if caching headers presentGET /cache/{value}- Sets Cache-Control headerGET /etag/{etag}- Returns given ETagGET /response-headers- Returns custom response headers from queryPOST /response-headers- Returns custom response headers from query
Cookies
GET /cookies- Returns cookiesGET /cookies/set- Sets cookies from query stringGET /cookies/set/{name}/{value}- Sets specific cookieGET /cookies/delete- Deletes cookies from query string
Images
GET /image- Returns image based on Accept headerGET /image/png- Returns PNG imageGET /image/jpeg- Returns JPEG imageGET /image/webp- Returns WebP imageGET /image/svg- Returns SVG image
Status Codes
/status/{codes}- Returns given status code or random from list (supports multiple methods)
Streaming Endpoints
GET /sse- Server-Sent Events endpoint with configurable event count, delay, and formatGET /sse/{count}- SSE with specified event countGET /sse/{count}/{delay}- SSE with specified event count and delayGET /ndjson- NDJSON streaming endpoint with configurable parametersGET /ndjson/{count}- NDJSON with specified event countGET /ndjson/{count}/{delay}- NDJSON with specified event count and delay
Usage
Command Line Arguments
Options:
-p, --port <PORT>- Port number to listen on (default: 8080)--no-current-server- Do not add current server to OpenAPI specification servers list--exclude-headers <HEADERS>- Exclude specific headers from responses. Comma-separated list of header keys, supports wildcard suffix matching (e.g., "foo, x-bar-*"). Built-in filtering for Nginx, Cloudflare, AWS, GCP, and Azure headers-h, --help- Print help information-V, --version- Print version information
Start the server
# Default port 8080
# Custom port
# Exclude headers
# Multiple options
The server will start on http://0.0.0.0:8080 (or specified port)
Example requests
# Basic GET request
# POST with JSON data
# Multiple HTTP methods on same endpoint
# Generate UUID
# Basic authentication
# Get compressed response
# Status codes
# Server-Sent Events
&format=simple
&delay=2000
&message="Hello%20World"
# NDJSON streaming
&format=simple
&model=llama3&delay=1500
&count=2
License
This project is licensed under the MIT License - see the LICENSE file for details.