This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 2 files changed +6
-10
lines changed 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
/* eslint-env browser */
3
3
4
- const ky = require ( 'ky-universal' )
4
+ const ky = require ( 'ky-universal' ) . default
5
5
const { isBrowser, isWebWorker } = require ( 'ipfs-utils/src/env' )
6
6
const { toUri } = require ( './multiaddr' )
7
7
const errorHandler = require ( './error-handler' )
@@ -18,11 +18,6 @@ module.exports = create => config => {
18
18
config = { ...config }
19
19
}
20
20
21
- if ( config . protocol || config . host || config . port ) {
22
- const port = config . port ? `:${ config . port } ` : ''
23
- config . apiAddr = `${ config . protocol || 'http' } ://${ config . host || 'localhost' } ${ port } `
24
- }
25
-
26
21
config . apiAddr = ( config . apiAddr || getDefaultApiAddr ( config ) ) . toString ( )
27
22
config . apiAddr = config . apiAddr . startsWith ( '/' ) ? toUri ( config . apiAddr ) : config . apiAddr
28
23
config . apiPath = config . apiPath || config [ 'api-path' ] || '/api/v0'
@@ -37,7 +32,8 @@ module.exports = create => config => {
37
32
hooks : {
38
33
afterResponse : [ errorHandler ]
39
34
}
40
- } )
35
+ } ) ,
36
+ ...config
41
37
} )
42
38
}
43
39
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ describe('lib/configure', () => {
14
14
it ( 'should accept no config' , ( ) => {
15
15
configure ( config => {
16
16
if ( isBrowser || isWebWorker ) {
17
- expect ( config . apiAddr ) . to . eql ( location . origin )
17
+ expect ( config . apiAddr ) . to . eql ( '' )
18
18
} else {
19
19
expect ( config . apiAddr ) . to . eql ( 'http://localhost:5001' )
20
20
}
@@ -48,7 +48,7 @@ describe('lib/configure', () => {
48
48
if ( isBrowser || isWebWorker ) {
49
49
expect ( config . apiAddr ) . to . eql ( `https://${ location . host } ` )
50
50
} else {
51
- expect ( config . apiAddr ) . to . eql ( 'https://localhost' )
51
+ expect ( config . apiAddr ) . to . eql ( 'https://localhost:5001 ' )
52
52
}
53
53
} ) ( input )
54
54
} )
@@ -59,7 +59,7 @@ describe('lib/configure', () => {
59
59
if ( isBrowser || isWebWorker ) {
60
60
expect ( config . apiAddr ) . to . eql ( `http://ipfs.io:${ location . port } ` )
61
61
} else {
62
- expect ( config . apiAddr ) . to . eql ( 'http://ipfs.io' )
62
+ expect ( config . apiAddr ) . to . eql ( 'http://ipfs.io:5001 ' )
63
63
}
64
64
} ) ( input )
65
65
} )
You can’t perform that action at this time.
0 commit comments