1 | ;
|
2 | // Copyright 2017 Google LLC
|
3 | //
|
4 | // Licensed under the Apache License, Version 2.0 (the "License");
|
5 | // you may not use this file except in compliance with the License.
|
6 | // You may obtain a copy of the License at
|
7 | //
|
8 | // http://www.apache.org/licenses/LICENSE-2.0
|
9 | //
|
10 | // Unless required by applicable law or agreed to in writing, software
|
11 | // distributed under the License is distributed on an "AS IS" BASIS,
|
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | // See the License for the specific language governing permissions and
|
14 | // limitations under the License.
|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | exports.validate = void 0;
|
17 | // Accepts an options object passed from the user to the API. In the
|
18 | // previous version of the API, it referred to a `Request` options object.
|
19 | // Now it refers to an Axiox Request Config object. This is here to help
|
20 | // ensure users don't pass invalid options when they upgrade from 0.x to 1.x.
|
21 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
22 | function validate(options) {
|
23 | const vpairs = [
|
24 | { invalid: 'uri', expected: 'url' },
|
25 | { invalid: 'json', expected: 'data' },
|
26 | { invalid: 'qs', expected: 'params' },
|
27 | ];
|
28 | for (const pair of vpairs) {
|
29 | if (options[pair.invalid]) {
|
30 | const e = `'${pair.invalid}' is not a valid configuration option. Please use '${pair.expected}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`;
|
31 | throw new Error(e);
|
32 | }
|
33 | }
|
34 | }
|
35 | exports.validate = validate;
|
36 | //# sourceMappingURL=options.js.map |
\ | No newline at end of file |