Skip to content

Commit

Permalink
Merge fef9c3f into b475f5d
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippSpo committed Mar 1, 2016
2 parents b475f5d + fef9c3f commit 699775b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/coffee/connect/rest.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Rest
PAGED: (resource, resolve) ->
splitted = resource.split('?')
endpoint = splitted[0]
query = _.parseQuery splitted[1]
query = _.parseQuery splitted[1], false

throw new Error 'Query limit doesn\'t seem to be 0. This function queries all results, are you sure you want to use this?' if query.limit and query.limit isnt '0'

Expand Down
10 changes: 10 additions & 0 deletions src/spec/connect/rest.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,16 @@ describe 'Rest', ->
withTotal: false
done()

it 'should not overwrite duplicate url parameters', (done) ->
spyOn(@pagedRest, 'GET').andCallThrough()
@pagedRest.PAGED "/products?expand=foo&expand=bar", (e, r, b) =>
url = @pagedRest.GET.calls[0].args[0]
query = url.split('?')[1]
query = query.split('&')
expect(query[0]).toEqual('expand=foo')
expect(query[1]).toEqual('expand=bar')
done()

it 'should correctly return error', (done) ->
spyOn(@pagedRest, 'GET').andCallFake (endpoint, callback) ->
callback('Oops', {statusCode: 500}, null)
Expand Down

0 comments on commit 699775b

Please sign in to comment.