SuperTest · Schema

SuperTest Test Configuration

JSON Schema representing a SuperTest HTTP test request configuration for documentation and tooling purposes.

TestingFunctional TestingHTTP TestingNode.jsJavaScriptOpen SourceAPI TestingIntegration TestingSuperAgentFluent API

Properties

Name Type Description
method string HTTP method for the test request
path string URL path to send the request to
headers object Request headers to set
query object Query string parameters
body object Request body payload (for POST/PUT/PATCH)
expect object Assertions to make on the response
timeout integer Request timeout in milliseconds
redirects integer Number of redirects to follow
View JSON Schema on GitHub

JSON Schema

supertest-test-config-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/supertest/main/json-schema/supertest-test-config-schema.json",
  "title": "SuperTest Test Configuration",
  "description": "JSON Schema representing a SuperTest HTTP test request configuration for documentation and tooling purposes.",
  "type": "object",
  "properties": {
    "method": {
      "type": "string",
      "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"],
      "description": "HTTP method for the test request"
    },
    "path": {
      "type": "string",
      "description": "URL path to send the request to",
      "example": "/api/users"
    },
    "headers": {
      "type": "object",
      "description": "Request headers to set",
      "additionalProperties": {
        "type": "string"
      }
    },
    "query": {
      "type": "object",
      "description": "Query string parameters",
      "additionalProperties": true
    },
    "body": {
      "description": "Request body payload (for POST/PUT/PATCH)",
      "oneOf": [
        { "type": "object" },
        { "type": "string" },
        { "type": "array" }
      ]
    },
    "expect": {
      "type": "object",
      "description": "Assertions to make on the response",
      "properties": {
        "status": {
          "type": "integer",
          "description": "Expected HTTP status code",
          "example": 200
        },
        "headers": {
          "type": "object",
          "description": "Expected response headers",
          "additionalProperties": {
            "type": "string"
          }
        },
        "body": {
          "description": "Expected response body or body field",
          "oneOf": [
            { "type": "object" },
            { "type": "string" },
            { "type": "array" }
          ]
        },
        "contentType": {
          "type": "string",
          "description": "Expected Content-Type",
          "example": "application/json"
        }
      }
    },
    "timeout": {
      "type": "integer",
      "description": "Request timeout in milliseconds",
      "default": 5000
    },
    "redirects": {
      "type": "integer",
      "description": "Number of redirects to follow",
      "default": 0
    }
  },
  "required": ["method", "path"]
}