mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-21 14:18:05 +08:00
Use postman-echo to replace httpbin
This commit is contained in:
@@ -15,18 +15,18 @@ describe('auth', () => {
|
||||
bh
|
||||
])
|
||||
const res: httpm.HttpClientResponse = await http.get(
|
||||
'http://httpbin.org/get'
|
||||
'http://postman-echo.com/get'
|
||||
)
|
||||
expect(res.message.statusCode).toBe(200)
|
||||
const body: string = await res.readBody()
|
||||
const obj = JSON.parse(body)
|
||||
const auth: string = obj.headers.Authorization
|
||||
const auth: string = obj.headers.authorization
|
||||
const creds: string = Buffer.from(
|
||||
auth.substring('Basic '.length),
|
||||
'base64'
|
||||
).toString()
|
||||
expect(creds).toBe('johndoe:password')
|
||||
expect(obj.url).toBe('http://httpbin.org/get')
|
||||
expect(obj.url).toBe('http://postman-echo.com/get')
|
||||
})
|
||||
|
||||
it('does basic http get request with pat token auth', async () => {
|
||||
@@ -39,18 +39,18 @@ describe('auth', () => {
|
||||
ph
|
||||
])
|
||||
const res: httpm.HttpClientResponse = await http.get(
|
||||
'http://httpbin.org/get'
|
||||
'http://postman-echo.com/get'
|
||||
)
|
||||
expect(res.message.statusCode).toBe(200)
|
||||
const body: string = await res.readBody()
|
||||
const obj = JSON.parse(body)
|
||||
const auth: string = obj.headers.Authorization
|
||||
const auth: string = obj.headers.authorization
|
||||
const creds: string = Buffer.from(
|
||||
auth.substring('Basic '.length),
|
||||
'base64'
|
||||
).toString()
|
||||
expect(creds).toBe(`PAT:${token}`)
|
||||
expect(obj.url).toBe('http://httpbin.org/get')
|
||||
expect(obj.url).toBe('http://postman-echo.com/get')
|
||||
})
|
||||
|
||||
it('does basic http get request with pat token auth', async () => {
|
||||
@@ -61,13 +61,13 @@ describe('auth', () => {
|
||||
ph
|
||||
])
|
||||
const res: httpm.HttpClientResponse = await http.get(
|
||||
'http://httpbin.org/get'
|
||||
'http://postman-echo.com/get'
|
||||
)
|
||||
expect(res.message.statusCode).toBe(200)
|
||||
const body: string = await res.readBody()
|
||||
const obj = JSON.parse(body)
|
||||
const auth: string = obj.headers.Authorization
|
||||
const auth: string = obj.headers.authorization
|
||||
expect(auth).toBe(`Bearer ${token}`)
|
||||
expect(obj.url).toBe('http://httpbin.org/get')
|
||||
expect(obj.url).toBe('http://postman-echo.com/get')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user