Skip to content

Commit

Permalink
refactor: remove statusMessage
Browse files Browse the repository at this point in the history
It isn't consistent between browsers
  • Loading branch information
Kikobeats committed Mar 5, 2022
1 parent 62963dd commit d6116ff
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const got = async (url, opts) => {
if (opts.timeout === undefined) opts.timeout = false
const response = await ky(url, opts)
const body = await response.json()
const { headers, status: statusCode, statusText: statusMessage } = response
return { url: response.url, body, headers, statusCode, statusMessage }
const { headers, status: statusCode } = response
return { url: response.url, body, headers, statusCode }
} catch (err) {
if (err.response) {
const { response } = err
Expand Down
6 changes: 5 additions & 1 deletion test/opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ import clients from './clients'

clients.forEach(({ constructor: mql, target }) => {
test(`${target} » url`, async t => {
const { status, data, response } = await mql('https://kikobeats.com?ref=mql')
const { status, data, response } = await mql(
'https://kikobeats.com?ref=mql'
)
const { date, ...restData } = data

t.snapshot(status)
t.snapshot(restData)
t.snapshot(response.url)
t.snapshot(response.statusCode)
})

if (target === 'node') {
Expand Down
20 changes: 20 additions & 0 deletions test/snapshots/opts.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,23 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 3
'https://api.microlink.io/?url=https%3A%2F%2Fkikobeats.com%3Fref%3Dmql'

## node » url

> Snapshot 4
200

> Snapshot 5
'OK'

## browser » url

> Snapshot 4
200

> Snapshot 5
'OK'
Binary file modified test/snapshots/opts.js.snap
Binary file not shown.

0 comments on commit d6116ff

Please sign in to comment.