Skip to content

Commit

Permalink
fix(api): Remove ES6 features to add support for older versions of Node
Browse files Browse the repository at this point in the history
  • Loading branch information
sosna committed Apr 18, 2016
1 parent 64bd5d3 commit a67f934
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ addHeaders = (opts, s, isDataQuery) ->
opts

guessService = (u) ->
s = (Service[k] for own k of Service when u.startsWith Service[k]?.url)
s = (Service[k] for own k of Service when u.indexOf(Service[k]?.url) > -1)
return s[0] ? {}

#
Expand Down Expand Up @@ -236,7 +236,7 @@ request = (params...) ->
u = if typeof q is 'string' then q else getUrl q, s
o = if typeof q is 'string' then params[1] else params[2]
isDataQuery = false
if typeof q is 'string' and q.includes '/data/'
if typeof q is 'string' and q.indexOf('/data/') > -1
isDataQuery = true
else if q.flow
isDataQuery = true
Expand Down
6 changes: 3 additions & 3 deletions test/index.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe 'API', ->
it 'adds an accept header to data queries if the service has a default format', ->
query = nock('http://sdw-wsrest.ecb.europa.eu')
.matchHeader('accept', (h) ->
h[0].includes 'application/vnd.sdmx.data+json')
h[0].indexOf('application/vnd.sdmx.data+json') > -1)
.get((uri) -> uri.indexOf('EXR') > -1)
.reply 200, 'OK'
response =
Expand All @@ -201,7 +201,7 @@ describe 'API', ->
it 'adds an accept header to data URLs if the service has a default format', ->
query = nock('http://sdw-wsrest.ecb.europa.eu')
.matchHeader('accept', (h) ->
h[0].includes 'application/vnd.sdmx.data+json')
h[0].indexOf('application/vnd.sdmx.data+json') > -1)
.get((uri) -> uri.indexOf('EXR') > -1)
.reply 200, 'OK'
url = 'http://sdw-wsrest.ecb.europa.eu/service/data/EXR/A..EUR.SP00.A'
Expand All @@ -211,7 +211,7 @@ describe 'API', ->
it 'does not overwrite the accept header passed by the client', ->
query = nock('http://sdw-wsrest.ecb.europa.eu')
.matchHeader('accept', (h) ->
h[0].includes 'application/xml')
h[0].indexOf('application/xml') > -1)
.get((uri) -> uri.indexOf('EXR') > -1)
.reply 200, 'OK'
opts =
Expand Down

0 comments on commit a67f934

Please sign in to comment.