Connectors
HTTP
Call a JSON API that has no connector of its own.
@puppi/adapter-http is a JSON connection for an API that has no connector of its own. get(path, params) sends GET <base_url><path> and decodes the body as JSON.
Pass the module to defineConfig:
import * as http from "@puppi/adapter-http";
import { defineConfig } from "@puppi/sdk";
export default defineConfig({
connections: { api: http },
}); Config
| Field | Meaning |
|---|---|
base_url | Host the binding sets. |
headers | JSON object added to every request. |
api_key_header | Header name for api_key. The default is x-api-key. |
api_key_query | Query parameter name for api_key. When it is set, the key is not sent as a header. |
Secrets
Both secrets are optional. An empty value sends nothing.
| Secret | Sent as |
|---|---|
bearer_token | Authorization: Bearer |
api_key | The header named by api_key_header, or the query parameter named by api_key_query |