Skip to content

Commit

Permalink
Merge pull request #1429 from actions/rentziass/postman
Browse files Browse the repository at this point in the history
Use postman-echo to replace httpbin
  • Loading branch information
rentziass authored May 23, 2023
2 parents 12c01ac + bbab4be commit 37e09c5
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 122 deletions.
18 changes: 9 additions & 9 deletions packages/http-client/__tests__/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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')
})
})
Loading

0 comments on commit 37e09c5

Please sign in to comment.