Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 857 Bytes

http.md

File metadata and controls

52 lines (43 loc) · 857 Bytes

HTTP

Used to start a HTTP dependency.

Specs

  • Name: http
  • Dev Port: 9090

Configuration

N/A

Defaults Example

---
requests:
  - request:
      method: GET
      url: "/api/v1/foo"
    response:
      status: 200
      headers:
        Content-Type: text/plain
      body: Hello HTTP!
  - request:
      method: GET
      url: "/api/v1/bar"
    response:
      status: 200
      headers:
        Content-Type: application/json
      jsonBody:
        {
          "customJson": [
            "Hello",
            "HTTP"
          ],
          "foo": "bar"
        }

Usage Example

# Return JSON when a GET request is made to an endpoint
self.deps.http.setup().get('/some-endpoint', {'foo': 'bar'})

# Verify that an endpoint was called
result: bool = self.deps.http.verify().get_called('/some-endpoint')