Skip to content

Commit

Permalink
feat: use custom @octokit/request instance
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Sep 4, 2019
1 parent 9d9e618 commit d457a93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ export const graphql = withDefaults(request, {
method: "POST",
url: "/graphql"
});

export function withCustomRequest(customRequest: typeof request) {
return withDefaults(customRequest, {
method: "POST",
url: "/graphql"
});
}
6 changes: 4 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Agent } from "http";
import { request } from "@octokit/request";
import { request as Request } from "@octokit/request";

export type Query = string;

Expand Down Expand Up @@ -27,9 +27,11 @@ export interface graphql {
/**
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
*/
endpoint: typeof request.endpoint;
endpoint: typeof Request.endpoint;
}

// export type withCustomRequest = (request: typeof Request) => graphql;

export type GraphQlQueryResponseData = {
[key: string]: any;
} | null;
Expand Down

0 comments on commit d457a93

Please sign in to comment.