Skip to content

Commit

Permalink
fix: use teeny-request for HTTP requests (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Oct 31, 2018
1 parent 1732212 commit 7e08a06
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"is": "^3.0.1",
"stream-events": "^1.0.1",
"string-format-obj": "^1.0.0",
"teeny-request": "^3.11.0",
"uuid": "^3.1.0"
},
"devDependencies": {
Expand All @@ -91,6 +92,7 @@
"@types/extend": "^3.0.0",
"@types/is": "0.0.20",
"@types/mocha": "^5.2.5",
"@types/request": "^2.48.0",
"@types/sinon": "^5.0.5",
"@types/uuid": "^3.4.4",
"async": "^2.6.0",
Expand Down
3 changes: 2 additions & 1 deletion src/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import * as extend from 'extend';
import * as is from 'is';
import {Table, TableOptions} from './table';
import * as r from 'request';
import {teenyRequest} from 'teeny-request';
import {BigQuery, CreateQueryJobResponse, CreateQueryJobCallback} from '.';

export interface DatasetDeleteOptions {
Expand Down Expand Up @@ -238,7 +239,7 @@ class Dataset extends ServiceObject {
baseUrl: '/datasets',
id,
methods,
requestModule: r,
requestModule: teenyRequest as typeof r,
createMethod: (
id: string,
optionsOrCallback?: CreateDatasetOptions|CreateDatasetCallback,
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const format = require('string-format-obj');
import * as is from 'is';
import * as r from 'request';
import * as uuid from 'uuid';
import {teenyRequest} from 'teeny-request';

import {Dataset, DataSetOptions} from './dataset';
import {Job, JobOptions} from './job';
Expand Down Expand Up @@ -184,7 +185,7 @@ export class BigQuery extends common.Service {
baseUrl: 'https://www.googleapis.com/bigquery/v2',
scopes: ['https://www.googleapis.com/auth/bigquery'],
packageJson: require('../../package.json'),
requestModule: r,
requestModule: teenyRequest as typeof r,
};

if (options.scopes) {
Expand Down
3 changes: 2 additions & 1 deletion src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {paginator} from '@google-cloud/paginator';
import * as extend from 'extend';
import * as r from 'request';
import {BigQuery} from '../src';
import {teenyRequest} from 'teeny-request';

export interface JobOptions {
location?: string;
Expand Down Expand Up @@ -257,7 +258,7 @@ class Job extends Operation {
baseUrl: '/jobs',
id,
methods,
requestModule: r,
requestModule: teenyRequest as typeof r,
});

this.bigQuery = bigQuery;
Expand Down
5 changes: 3 additions & 2 deletions src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import * as uuid from 'uuid';
import {BigQuery, Job, Dataset} from '../src';
import {GoogleErrorBody} from '@google-cloud/common/build/src/util';
import {Writable} from 'stream';
import {teenyRequest} from 'teeny-request';

export type CreateCopyJobResponse = [Job, r.Response];
export interface CreateCopyJobCallback {
Expand Down Expand Up @@ -310,7 +311,7 @@ class Table extends common.ServiceObject {
id,
createMethod: dataset.createTable.bind(dataset),
methods,
requestModule: r,
requestModule: teenyRequest as typeof r,
});

if (options && options.location) {
Expand Down Expand Up @@ -1259,7 +1260,7 @@ class Table extends common.ServiceObject {
common.util.makeWritableStream(
dup, {
makeAuthenticatedRequest: this.bigQuery.makeAuthenticatedRequest,
requestModule: r,
requestModule: teenyRequest as typeof r,
metadata: {
configuration: {
load: metadata,
Expand Down

0 comments on commit 7e08a06

Please sign in to comment.