Skip to main content

Crate nmbrs_adapter_http

Crate nmbrs_adapter_http 

Source
Expand description

HTTP adapter: executes operations as HTTP requests.

Op template fields map to HTTP request components:

  • method — GET, POST, PUT, DELETE, PATCH, HEAD (default: GET)
  • uri or url — the request URL (required)
  • body — request body (for POST/PUT/PATCH)
  • content_type — Content-Type header (default: application/json)
  • headers — additional headers as “Name: Value” lines
  • ok_status — expected status codes (default: 200-299)

Example workload:

bindings: |
  user_id := mod(hash(cycle), 1000000)
ops:
  read:
    method: GET
    uri: "http://localhost:8080/api/users/{user_id}"
  write:
    method: POST
    uri: "http://localhost:8080/api/users"
    body: '{"id": {user_id}, "name": "user_{user_id}"}'
    content_type: application/json

Structs§

HttpAdapter
The HTTP adapter: executes ops as HTTP requests.
HttpConfig
Configuration for the HTTP adapter.