This is a simple HTTP server which I create while learning about HTTP requests in GoLang. Mocked data is generated using gofakeit
Releases are signed with my release key
To run this program you can download either the docker image or a release binary.
By default the host is 0.0.0.0
and it can be changed with an environment variable of HOST
By default the port is 8090
and it can be changed with an environment variable of PORT
There are images on both Github and Dockerhub.
Docker:
docker run -d -p 8090:8090 cyb3rjak3/simple_http_server
Github:
docker run -d -p 8090:8090 ghcr.io/cyb3r-jak3/simple_http_server
The routes that are available are:
Returns a simple hello message
Echos back the headers that were sent with the request
Echos back the JSON that was sent with the request
Saves a posted multipart/form-data file to the server.
Required: The key of the posted file to be "file"
Saves a post binary file with the name
Required:
{name}: Query string set that will set the name of the file
Returns a number of JSON rows
Optional:
{rows}: Return the number of rows to generate. Default is 10
Returns a number of XML rows
Optional:
{rows}: Return the number of rows to generate. Default is 10
Returns an IPv4 address
Returns an IPv6 address
Returns a paragraph that has been base64 encoded
Returns a csv file
Optional:
{rows}: Return the number of rows to generate. Default is 10
Returns an image either JPG, PNG or the url to download
Optional:
- {type}: Type to generate. Valid options are url, png, jpg
- {height}: Height in pixels of the image
- {width}: Width in pixels of the image. If none is given a square image of height will be generated
Returns a UUID4 as a string
Returns the cookies of the request
Set a cookie in the response
Required:
- {name}: Name of the Cookie
- {value}: Value of the cookie
Clears all the cookies from a request
Return a request with status code
Optional: - {code}: HTTP status code to return
Return to the constant domain
Optional:
- {code}: HTTP redirect code between 300 and 307
Generates HTTP Basic auth
Required:
- {username}: User name to login with
- {password}: Password to login with
HTTP basic auth with username and password of admin