Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ coverage
############################
.env
.envrc
install.log
pnpm-lock.yaml
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"url"
],
"dependencies": {
"data-uri-utils": "~1.0.15",
"got": "~11.8.6"
"@kikobeats/got": "~11.8.8",
"data-uri-utils": "~1.0.15"
},
"devDependencies": {
"@commitlint/cli": "latest",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
allowBuilds:
simple-git-hooks: true
spawn-sync: true
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const dataUri = require('data-uri-utils')
const got = require('got').extend({ throwHttpErrors: false })
const got = require('@kikobeats/got').extend({ throwHttpErrors: false })

const finiteLength = value => {
if (!value) return
Expand All @@ -10,9 +10,7 @@ const finiteLength = value => {
}

const fromHeaders = headers => {
const normalized = headers.entries
? Object.fromEntries(headers)
: headers
const normalized = headers.entries ? Object.fromEntries(headers) : headers

const fromRange = finiteLength(normalized['content-range']?.split('/').pop())
if (fromRange !== undefined) return fromRange
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const http = require('http')
const got = require('got')
const got = require('@kikobeats/got')
const test = require('ava').default

const contentLength = require('..')
Expand Down