Skip to main content

@svatah/yam-adapter-http

HTTP/API adapter

Exports

ExportKindSignature
ApiRequestErrorclassexport class ApiRequestError extends Error
createHttpSurfacefunctionexport function createHttpSurface(config: Config, overrides: HttpAdapterOptions = {}): HttpSurfaceBuild an HTTP surface from a project config (LLD §2.4).
executeRequestfunctionexport async function executeRequest(Execute one request.
expandfunctionexport function expand(text: string, scope: TemplateScope): stringExpand every {…} in a string. A reference with no value becomes empty.
expandRecordfunctionexport function expandRecord(Expand every string in a record.
fillPathParamsfunctionexport function fillPathParams(Substitute :name and {name} in a URL path from pathParams.
HttpAdapterOptionsinterfaceexport interface HttpAdapterOptions
HttpSurfaceclassexport class HttpSurface implements AgentSurface
JsonPathErrorclassexport class JsonPathError extends Error {}The JSON-path subset a capture uses (REQ-ADP-2: "responses are JSON-path
parseJsonPathfunctionexport function parseJsonPath(path: string): Segment[]Parse $.a.b[0] into segments. Throws on anything outside the subset.
readJsonPathfunctionexport function readJsonPath(body: unknown, path: string): unknownRead a path out of a parsed body. undefined when it is not there.
registerHttpAdapterfunctionexport function registerHttpAdapter(): void
RequestOptionsinterfaceexport interface RequestOptions
TemplateScopeinterfaceexport interface TemplateScopeWhat a template can read. {data.x}, {input.x}, {x} and {Story.x}.