Skip to content

Commit e47c3d7

Browse files
committed
Use 'rawBody' consistently throughout the client API
1 parent e3c9729 commit e47c3d7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/api/rest-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function exposeRestAPI(
104104
if (evt.type === 'response-body-part') {
105105
res.write(JSON.stringify({
106106
...evt,
107-
data: evt.data.toString('base64')
107+
rawBody: evt.rawBody.toString('base64')
108108
}));
109109
} else {
110110
res.write(JSON.stringify(evt));

src/client/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface ResponseHead {
3939

4040
export interface ResponseBodyPart {
4141
type: 'response-body-part';
42-
data: Buffer;
42+
rawBody: Buffer;
4343
}
4444

4545
export function sendRequest(
@@ -89,7 +89,7 @@ export function sendRequest(
8989

9090
response.on('data', (data) => resultsStream.push({
9191
type: 'response-body-part',
92-
data
92+
rawBody: data
9393
}));
9494

9595
response.on('end', () => resultsStream.push(null));

test/client/send-request.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ describe("The HTTP client API", () => {
5454
});
5555

5656
expect(responseEvents[1].type).equal('response-body-part');
57-
expect(responseEvents[1].data.toString()).to.equal('Mock response body');
57+
expect(responseEvents[1].rawBody.toString()).to.equal('Mock response body');
5858
})
5959
});

test/integration-test.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ describe('Integration test', function () {
370370

371371
expect(responseEvents[1].type).equal('response-body-part');
372372
expect(
373-
Buffer.from(responseEvents[1].data, 'base64').toString('utf8')
373+
Buffer.from(responseEvents[1].rawBody, 'base64').toString('utf8')
374374
).to.equal('Mock response body');
375375

376376

0 commit comments

Comments
 (0)