deno.land / x / oauth4webapi@v1.2.2 / test / protected_resource.test.ts

protected_resource.test.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import anyTest, { type TestFn } from 'ava'import setup, { type Context, teardown } from './_setup.js'import * as lib from '../src/index.js'
const test = anyTest as TestFn<Context>
test.before(setup)test.after(teardown)
test('protectedResource()', async (t) => { t.context.mock .get('https://rs.example.com') .intercept({ path: '/resource', method: 'GET', headers: { authorization: 'Bearer token', }, }) .reply(200, '') const url = new URL('https://rs.example.com/resource') const response = await lib.protectedResourceRequest('token', 'GET', url, new Headers(), null) t.true(response instanceof Response)})
oauth4webapi

Version Info

Tagged at
2 years ago