Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Remove options.ts #1920

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/options.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/transporters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import {
GaxiosPromise,
GaxiosResponse,
} from 'gaxios';
import {validate} from './options';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const pkg = require('../../package.json');

const PRODUCT_NAME = 'google-api-nodejs-client';
Expand Down Expand Up @@ -85,7 +83,6 @@ export class DefaultTransporter implements Transporter {
request<T>(opts: GaxiosOptions): GaxiosPromise<T> {
// ensure the user isn't passing in request-style options
opts = this.configure(opts);
validate(opts);
return this.instance.request<T>(opts).catch(e => {
throw this.processError(e);
});
Expand Down
10 changes: 0 additions & 10 deletions test/test.transporters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import * as assert from 'assert';
import {describe, it, afterEach} from 'mocha';
import {GaxiosOptions} from 'gaxios';

Check warning on line 17 in test/test.transporters.ts

View workflow job for this annotation

GitHub Actions / lint

'GaxiosOptions' is defined but never used
import * as nock from 'nock';
import {DefaultTransporter, RequestError} from '../src/transporters';

Expand Down Expand Up @@ -121,16 +121,6 @@
);
});

it('should return an error if you try to use request config options with a promise', async () => {
const expected = new RegExp(
"'uri' is not a valid configuration option. Please use 'url' instead. This " +
'library is using Axios for requests. Please see https://github.com/axios/axios ' +
'to learn more about the valid request options.'
);
const uri = 'http://example.com/api';
assert.throws(() => transporter.request({uri} as GaxiosOptions), expected);
});

it('should support invocation with async/await', async () => {
const url = 'http://example.com';
const scope = nock(url).get('/').reply(200);
Expand Down
Loading