Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove default limit on request body length #145

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/request-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class RequestWrapper {
// defaults here
const axiosConfig: AxiosRequestConfig = {
maxContentLength: Infinity,
maxBodyLength: Infinity,
headers: {
post: {
'Content-Type': 'application/json',
Expand Down
3 changes: 3 additions & 0 deletions test/unit/request-wrapper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ describe('RequestWrapper constructor', () => {
// axios instance with it
const createdAxiosConfig = axios.default.create.mock.calls[0][0];
expect(createdAxiosConfig.maxContentLength).toBe(Infinity);
expect(createdAxiosConfig.maxBodyLength).toBe(Infinity);
expect(createdAxiosConfig.headers).toBeDefined();
expect(createdAxiosConfig.headers.post).toBeDefined();
expect(createdAxiosConfig.headers.put).toBeDefined();
Expand All @@ -78,10 +79,12 @@ describe('RequestWrapper constructor', () => {
it('should override the defaults with user-provided input', () => {
const unused = new RequestWrapper({
maxContentLength: 100,
maxBodyLength: 200,
});

const createdAxiosConfig = axios.default.create.mock.calls[0][0];
expect(createdAxiosConfig.maxContentLength).toBe(100);
expect(createdAxiosConfig.maxBodyLength).toBe(200);
});

it('creates a custom https agent when disableSslVerification is true', () => {
Expand Down