UNPKG

@protobuf-ts/twirp-transport

Version:

Twirp transport for clients generated by the protoc plugin "protobuf-ts".

18 lines (17 loc) 719 B
import { JsonValue } from "@protobuf-ts/runtime"; import { RpcError, RpcMetadata } from "@protobuf-ts/runtime-rpc"; /** * Create fetch API headers for a Twirp request. */ export declare function createTwirpRequestHeader(headers: Headers, sendJson: boolean, meta?: RpcMetadata): Headers; /** * Parse Twirp error message from JSON and create RpcError from the Twirp error. * * see https://twitchtv.github.io/twirp/docs/spec_v5.html */ export declare function parseTwirpErrorResponse(json: JsonValue): RpcError; /** * Parses fetch API response headers to RpcMetaData. * Drops the headers Content-Type and Content-Length. */ export declare function parseMetadataFromResponseHeaders(headers: Headers): RpcMetadata;