notsobad / go-fakesite

A Fakesite for http test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌐 Go-Fakesite

Go-Fakesite is a mock website generator for HTTP testing. It is a Go version of ynm3k. This tool is designed to simulate various URL addresses, static and dynamic web pages, different status codes, response sizes, and more. It is particularly useful for testing CDN and WAF systems.

πŸ”§ Installation

To install Go-Fakesite, use the following command:

go install github.com/notsobad/go-fakesite

πŸ’» Usage

To run Go-Fakesite, use the following command:

go-fakesite

You can then access the site at http://localhost:9527/.

🌟 Features

πŸ“ Static Files

Visiting the same URL will yield the same result. Use the following format:

/static/$RANDOM.$EXT

Examples:

πŸŒ€ Dynamic URLs

Visiting the same URL will yield different results. Use the following format:

/dynamic/$RANDOM.$EXT

Examples:

⚠️ HTTP Status Codes

You can simulate different HTTP status codes. Use the following format:

/code/$CODE.$EXT

Examples:

πŸ“ˆ Specified Size Response

You can output a file of a specified size. Use the following format:

/size/$SIZE.$EXT

Examples:

🐌 Slow Response Server

You can simulate a slow server response. Visit /slow/$SECONDS and the URL will take $SECONDS time to render.

Examples:

πŸ”„ URL Redirect

You can simulate various URL redirect methods. Use the following format:

http://localhost:9527/redirect/$CODE?url=$URL

Normal redirect:

You can also redirect to a 'file://' protol address:

curl -v 'localhost:9527/redirect/301?url=file:///etc/passwd'

About

A Fakesite for http test


Languages

Language:Go 100.0%