Sign inSign up

kuskoman/stupid-http-mock

By kuskoman

•Updated almost 6 years ago

The mock you are usually making as one liner, but easy to re-use

Image
0

299

kuskoman/stupid-http-mock repository overview

⁠stupid-http-mock

Docker Cloud Automated build Docker Pulls

This is a really small application used to mock server in very basic cases.

⁠Installation

You can build this app from source or use prebuilt image from DockerHub⁠.

⁠Building from source

Building from sources requires Go⁠.

  1. Clone git repository

    git clone https://github.com/kuskoman/stupid-http-mock.git
    
  2. Continue to directory

    cd stupid-http-mock
    
  3. Build repository

    go build main.go
    

This should result with ready-to-use executable.

⁠Using image from DockerHub

Simply use (Docker⁠ required)

docker run -p <host port>:<container port> kuskoman/stupid-http-mock:latest

for example:

docker run -p 1234:8080 kuskoman/stupid-http-mock:latest

will run app on host port 1234.

⁠Usage

The application takes requests, responds with informations about request with status 200 OK⁠ and simply logs its properties.

Example of logs (after entering app url in browser using firefox with random user-agent plugin):

2020/10/19 15:30:29 Request received
URL: /
Method: GET
Host: localhost:8080
Body:
Headers:
  Cookie: csrftoken=zukg4pEjcCjeQfi3QpvmFaNH288TPxgeau5h6HpQ0GMcHBboQg8VEr61oJk2quFH
  Upgrade-Insecure-Requests: 1
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  Accept-Language: en-US,en;q=0.5
  Accept-Encoding: gzip, deflate
  Connection: keep-alive

⁠Why

Because I needed very simple mock server many times and I decided to create 'full' app, instead of short scripts every time it was needed.

Tag summary

Content type

Image

Digest

Size

6.4 MB

Last updated

almost 6 years ago

docker pull kuskoman/stupid-http-mock