diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-09-26 21:34:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-26 21:34:26 +0800 |
commit | c429409ed7a77a67368850f2e736126da0d213dd (patch) | |
tree | 08819f84186a0acf84411eca7c874e5164cf378f /packages/connect | |
parent | 13aa98f0f3431e4ea4db07794a06304c237e8d45 (diff) | |
parent | f15751d800d813e97b72a861547a9caa1d0d5e56 (diff) | |
download | dexon-0x-contracts-c429409ed7a77a67368850f2e736126da0d213dd.tar.gz dexon-0x-contracts-c429409ed7a77a67368850f2e736126da0d213dd.tar.zst dexon-0x-contracts-c429409ed7a77a67368850f2e736126da0d213dd.zip |
Merge pull request #1091 from 0xProject/feature/sra-spec/order-config-to-post-and-other-bugs
[connect][sra-spec] Update sra-spec and connect to have /order_config be a POST and other small improvements
Diffstat (limited to 'packages/connect')
-rw-r--r-- | packages/connect/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/connect/src/http_client.ts | 2 | ||||
-rw-r--r-- | packages/connect/test/http_client_test.ts | 6 |
3 files changed, 13 insertions, 4 deletions
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 9de956d4d..4106be881 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "3.0.0", + "changes": [ + { + "note": "Change /order_config request to a POST instead of GET", + "pr": 1091 + } + ] + }, + { "timestamp": 1537907159, "version": "2.0.4", "changes": [ diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index 8a68d6c23..bbd0d2042 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -149,7 +149,7 @@ export class HttpClient implements Client { params: requestOpts, payload: request, }; - const responseJson = await this._requestAsync('/order_config', HttpRequestType.Get, httpRequestOpts); + const responseJson = await this._requestAsync('/order_config', HttpRequestType.Post, httpRequestOpts); const fees = relayerResponseJsonParsers.parseOrderConfigResponseJson(responseJson); return fees; } diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 83b77021a..e9fc9372e 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -148,12 +148,12 @@ describe('HttpClient', () => { }; const url = `${relayUrl}/order_config`; it('gets order config', async () => { - fetchMock.get(url, orderConfigResponseJSON); + fetchMock.post(url, orderConfigResponseJSON); const fees = await relayerClient.getOrderConfigAsync(request); expect(fees).to.be.deep.equal(orderConfigResponse); }); it('does not mutate input', async () => { - fetchMock.get(url, orderConfigResponseJSON); + fetchMock.post(url, orderConfigResponseJSON); const makerAssetAmountBefore = request.makerAssetAmount; const takerAssetAmountBefore = request.takerAssetAmount; const expirationTimeSecondsBefore = request.expirationTimeSeconds; @@ -163,7 +163,7 @@ describe('HttpClient', () => { expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds); }); it('throws an error for invalid JSON response', async () => { - fetchMock.get(url, { test: 'dummy' }); + fetchMock.post(url, { test: 'dummy' }); expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected(); }); }); |