cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.4.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

tests/api-resources/api-gateway/configurations.test.ts

54lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import Cloudflare from 'cloudflare';
4import { Response } from 'node-fetch';
5
6const client = new Cloudflare({
7 apiKey: '144c9defac04969c7bfad8efaa8ea194',
8 apiEmail: 'user@example.com',
9 baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
10});
11
12describe('resource configurations', () => {
13 test('update: only required params', async () => {
14 const responsePromise = client.apiGateway.configurations.update({
15 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
16 auth_id_characteristics: [{ name: 'authorization', type: 'header' }],
17 });
18 const rawResponse = await responsePromise.asResponse();
19 expect(rawResponse).toBeInstanceOf(Response);
20 const response = await responsePromise;
21 expect(response).not.toBeInstanceOf(Response);
22 const dataAndResponse = await responsePromise.withResponse();
23 expect(dataAndResponse.data).toBe(response);
24 expect(dataAndResponse.response).toBe(rawResponse);
25 });
26
27 test('update: required and optional params', async () => {
28 const response = await client.apiGateway.configurations.update({
29 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
30 auth_id_characteristics: [{ name: 'authorization', type: 'header' }],
31 normalize: true,
32 });
33 });
34
35 test('get: only required params', async () => {
36 const responsePromise = client.apiGateway.configurations.get({
37 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
38 });
39 const rawResponse = await responsePromise.asResponse();
40 expect(rawResponse).toBeInstanceOf(Response);
41 const response = await responsePromise;
42 expect(response).not.toBeInstanceOf(Response);
43 const dataAndResponse = await responsePromise.withResponse();
44 expect(dataAndResponse.data).toBe(response);
45 expect(dataAndResponse.response).toBe(rawResponse);
46 });
47
48 test('get: required and optional params', async () => {
49 const response = await client.apiGateway.configurations.get({
50 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
51 normalize: true,
52 });
53 });
54});
55