Skip to content
GoNetSim

HTTP

Reference sheet for the HTTP service

The HTTP service simulates a basic web server. It has two modes of operation:

In “Fake” mode, requests to any URL will return a generic response with a configurable status code & headers. Supported file extensions (currently .html, .htm, .asp, .txt, .md, .js, .css) will return a realistic body of that type, and unsupported file extensions will return the default html page.

Option Type Default Description
enabled bool true Whether the HTTP service is enabled
listen string :80 The address and port to listen on (e.g. :80)
status int 200 The status code to return in “Fake” mode
mode string fake Which mode to use when serving files
root_dir string ./ Which directory to serve files from in “Real” mode

To see instructions on how to configure these options, see the configuration guide.

The HTTP service can be run on its own by passing it as a target to run:

Terminal window
gonetsim run http

This starts the HTTP service with the current configuration, without starting any other services (Including the HTTPS service; the HTTPS service is not started with this command).

You can test the HTTP service using curl.

  1. Start the HTTP service

    Terminal window
    gonetsim run http
  2. In a separate terminal, make a request to the service using curl

    Terminal window
    curl http://localhost
  3. Return to the GoNetSim instance and you should see a log of the request in the output