Skip to main content

A HTTP server to use for testing

Project description

Test HTTP Server
================

This is a simple HTTP server that will respond to a single HTTP request and
record some of the data. It is still an early version and doesn't do
everything you probably want.

[![Build Status](https://secure.travis-ci.org/philipcristiano/testhttpserver.png?branch=master)](http://travis-ci.org/philipcristiano/testhttpserver)

Installing
==========

pip install testhttpserver

Using in your tests
===================

To create a test server import the server

from testhttpserver import Server

And then create a new instance including the port, response status and
content.

server = Server(8000, response_status=200, response_content='Content')

After you make your request to http://localhost:8000/ . If you POST to the
server it will have ``request_headers``, ``request_content``, and
``request_path`` available.

When you are done remember to ``join()``!

server.join()

See ``tests/test_server.py`` for an example!


Server Parameters
================
port - The port the server will listen on

response_status - int of the status to return

response_content - string of content to return

response_headers - a list of tuples to return as headers

timeout - number of seconds before the server timesout and returns

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testhttpserver-0.1.4.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file testhttpserver-0.1.4.tar.gz.

File metadata

File hashes

Hashes for testhttpserver-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d4f535f0f8552aa0ca63df34519234c64273d431a51f31297cf113a0de770caf
MD5 235541838ca96eb3fbd2b74e8e96cf42
BLAKE2b-256 80b3a435c18f1643cc9cf751260a16572a438779f16a029f836138eb616d7256

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page