Skip to content

Commit

Permalink
fix: don't limit the request content length (#1113)
Browse files Browse the repository at this point in the history
  • Loading branch information
childish-sambino authored May 1, 2020
1 parent 1246402 commit f0ece73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/client/src/classes/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Client {
url: '',
method: 'GET',
headers: {},
maxContentLength: Infinity, // Don't limit the content length.
};
}

Expand Down
24 changes: 23 additions & 1 deletion packages/client/src/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,36 @@ describe('client', () => {
.then(() => scope.done());
});
});

it('should allow large payloads', () => {
const request = {
body: {
content: [
{
type: 'text/plain',
value: '#'.repeat(1024 * 1024 * 25), // 25 MB,
},
],
from: {
email: 'me@you.com',
},
personalizations: [],
subject: 'Hello, World!',
},
method: 'POST',
url: '/v3/mail/send',
};

return testRequest(request, 202);
});
});

describe('setImpersonateSubuser', () => {
const impersonateSubuser = 'abcxyz@this.is.a.test.subuser';
const sgClient = require('./client');
sgClient.setImpersonateSubuser(impersonateSubuser);

it('should set the imperonate subuser header', () => {
it('should set the impersonate subuser header', () => {
expect(sgClient.impersonateSubuser).to.equal(impersonateSubuser);
});
});
Expand Down

0 comments on commit f0ece73

Please sign in to comment.