Skip to content

Client, raw request and endpoint preparation

Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.

Bind the standard Octokit constructor and existing instances, Octokit.defaults(options | function), .plugin(...plugins), .plugins, and .VERSION. Preserve subclass/plugin inference and constructor options including auth strategy, base URL, user agent, time zone, request overrides and logger. Applying defaults or deriving a constructor is configuration; constructing a client with arbitrary user plugins can run user code. Defer client construction to layer acquisition.

Preserve both request(route, parameters?) and request(options), relative paths, absolute upload URLs, custom routes and method-specific defaults. Preserve the typed result for a literal route and the upstream fallback for a dynamic route. Keep request.defaults(...) callable and effectful on invocation. Expose endpoint(...), .DEFAULTS, .defaults, .merge and .parse as synchronous preparation, including their default-sensitive types. Keep the caller’s request objects immutable. Delegate merging, URI templates, media types, headers, previews, query/body selection and redirects to Octokit.

Return the original response shape, including status, headers, URL, data and any plugin extensions. Conditional GET can reject with 304; HEAD, 204 and 205 have distinct upstream body behavior. Preserve binary, text, SCIM/JSON, bigint-capable parsing, upload streams and parseSuccessResponseBody: false. A raw response body can outlive request completion; give a scoped body-stream adapter its own release contract. Never read a one-shot upload twice.

Check. Compare a fake transport’s inputs and upstream outputs for raw/options/defaulted calls, GHES paths, upload host override, HEAD, 304 and binary media. Exercise a custom fetch and a custom header hook together. Request · Endpoint · Core