Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Edgebin is a minimalist HTTP service designed to test your networking stack.

License

Notifications You must be signed in to change notification settings

jiacai2050/edgebin

Repository files navigation

Edgebin is a HTTP testing service, with a focus on edge deployment.

Inspired by the httpbin.org, it leverages the power of edge computing to deliver fast, reliable testing capabilities tailored for modern distributed networks.

Supported Platforms

Features

Supports most of the endpoints from the original httpbin.org, including:

  • HTTP methods
  • Authentication
  • Request inspection
  • Response inspection
  • Dynamic data
  • Status codes
  • Redirects
  • Cookies
  • Cache
  • Anything

All endpoints accept any HTTP method. Additionally, it includes features not found in the original httpbin:

  • /ip returns the requester's IP address along with geolocation information such as country, region, city, ASN, and more.

    {
      "origin": "2408:8240:e10:947c:2806:6bb2:c222:343c",
      "continent": "AS",
      "latitude": "30.29365",
      "longitude": "120.16142",
      "country": "CN",
      "region": "Zhejiang",
      "regionCode": "ZJ",
      "city": "Hangzhou",
      "postalCode": "310000",
      "timezone": "Asia/Shanghai",
      "asn": 4837,
      "asOrganization": "China Unicom",
      "colo": "LAX"
    }
  • /ws echoes back any message sent to it over a WebSocket connection. You can test it using wscat:

    wscat -c wss://edgebin.liujiacai.net/ws
  • /qrcode generates QR codes(svg) for any text or URL. Use query parameters to customize the output:

    • text: The text or URL to encode (required)
    • errorCorrectionLevel: Error correction level, one of L, M, Q, H. Default is H.
    • width: Width of the QR code in pixels. Default is 350.
    • margin: Define how much wide the quiet zone should be. Default is 4.
    • scale: Scale factor. A value of 1 means 1px per modules (black dots). Default is 4.

  • /md2html, /html2md converts between html and markdown. Use following methods to pass data:

    • POST request with raw body
    • url query parameter to convert a webpage
    • text query parameter to convert a short text.
    curl "https://edgebin.liujiacai.net/md2html" --data "# Hello, World"
    curl "https://edgebin.liujiacai.net/html2md" --data "<h1>Hello, World</h1>"
  • /page-meta: Fetches a webpage and extracts its metadata (title, description, image, etc.). Use the url query parameter to specify the target webpage.

  • /date: Returns current date and time. Supports the following query parameters to control output:

    • format: Output format. One of iso, locale, ts, timestamp, utc. Default is iso.
    • locale: BCP47 locale string, e.g., en-US, zh-CN. Used when format=locale.
    • timeZone: IANA time zone, e.g., Asia/Shanghai.
  • /mix returns what you send in the request body, and supports specific query strings as directives to construct a custom response.

    • s=code, sets the status code, e.g. s=418
    • h=key:value, adds a response header, e.g. h=Content-Type:text/plain
    • d=delay, delays the response by delay seconds, e.g. d=3

Frequently Used Endpoints

  • /get: Returns GET data
  • /ip: Returns the requester's IP address
  • /ipgeo: Returns the requester's IP address and geolocation information
  • /user-agent: Returns the requester's User-Agent
  • /headers: Returns the requester's HTTP headers
  • /status/:code: Returns a response with the given status code
  • /anything: Returns anything that was sent in the request
  • /delay/:n: Delays responding for n seconds
  • /redirect/:n: Redirects n times
  • /basic-auth/:user/:passwd: Challenges HTTP Basic Auth
  • /bearer: Challenges HTTP Bearer Auth
  • /cache/:max-age: Returns a response with Cache-Control: public, max-age=60
  • /response-headers?key=value: Returns a response with the given headers
  • /bytes/:n: Returns n random bytes
  • /xml: Returns a sample XML document
  • /html: Returns a sample HTML document
  • /json: Returns a sample JSON document
  • /gzip: Returns a gzip-encoded response
  • /brotli: Returns a brotli-encoded response
  • /deflate: Returns a deflate-encoded response
  • /anything/:anything: Returns anything that was sent in the request
  • /cookies: Returns the requester's cookies
  • /cookies/set?name=value: Sets cookies and redirects to /cookies
  • /cookies/delete?name=value: Deletes cookies and redirects to /cookies
  • /image/:type: Returns a random image of the given type (png, jpeg, webp, svg)

If you find an endpoint is missing or notice any unexpected behavior, we welcome you to open an issue or submit a pull request.

Deploy

Feel free to deploy your own instance of httpbin. The free tier of Cloudflare Workers is sufficient for most use cases.

Deploy to Cloudflare

If you'd like to share your public instance, please let us know and we'll add it to the list.

We have a Telegram group for discussion: https://t.me/edgebin.

Public Instances

Instance Maintainer
https://edgebin.liujiacai.net @jiacai2050

Development

# clone the repo and install dependencies
git clone https://github.com/jiacai2050/edgebin.git && cd edgebin
npm install

# start development server, listen on http://localhost:8787
npm run dev

# Deploy to Cloudflare Workers
# Make sure to set up your Cloudflare Workers environment first
# https://developers.cloudflare.com/workers/get-started/guide/
npm run deploy

In the future, we may support other edge platforms like Vercel Edge Functions and Deno Deploy.

License

MIT License

About

Edgebin is a minimalist HTTP service designed to test your networking stack.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •