Skip to main content

HTTP testing tool

Project description



testhttp allows you to send HTTP request for testing your endpoints. This is still very incomplete but satisfy my needs at the moment. Feel free to suggest or create changes for updates.


  • The goal is to be compatible with vscode-restclient but with ability to assert results and automate dependencies.
  • Run named or by index http definition
  • Import other files to re-use http definition
  • Set global variables as a context for the scripts


pip install testhttp
# -h for help
testhttp -h

# Run a file
testhttp --file sample.http

# Run all files based on glob pattern
testhttp --pattern '/Users/path/to/**/test/*.http'
# Declaring a global variable that will be available for all scripts
testhttp --var host=https://baseurl/
# Automatically remove steps with the same name
testhttp --distinct


In editor, type an HTTP request as simple as below:


# @name postToExample
content-type: application/json

    "name": "sample",
    "time": "Wed, 21 Oct 2015 18:27:50 GMT"


assert {{response.status_code}} == 404

Save it as sample.http then run the command below:

# add --verbose to see request and response information 
# add --debug for debug info
testhttp --file.sample.http --name postToExample


You can import other files by:

@import other_file.http


... rest of your http info

This will do a lookup relative to current file. Without specifying --name or --index it will still only run all tests under the current file and will only run things it depends on.

Variables & Dependencies

Running by name will result in execution of it's variable dependencies. This way you can only test specific spec and it will still work with single command.

@user = hello
@password = world
@baseUrl =

# @name login
POST {{baseUrl}}/api/login HTTP/1.1
content-type: application/json

    "username": "{{user}}",
    "password": "{{password}}"


assert {{response.status_code}} == 200


@token = {{login.response.body.token}}

# @name getCurrentUser
GET {{baseUrl}}/api/me HTTP/1.1
content-type: application/json
Authorization: {{token}}


assert {{response.status_code}} == 200
assert {{response.body.username}} == {{user}}

Running only getCurrentUser will automatically run login since it depends on login in the token variable.

Project details

Download files

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

Files for testhttp, version 0.6.6
Filename, size File type Python version Upload date Hashes
Filename, size testhttp-0.6.6.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page