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

feat: add support for compressing request bodies #111

Merged
merged 1 commit into from
Oct 6, 2020
Merged

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Oct 2, 2020

A flag can now be passed to the BaseService that will enable gzip compression on the request body data. This flag is passed down to the RequestWrapper class where the compression code lives. Note that no code needs to be changed in the BaseService - the options passed into its constructor will be carried through to the RequestWrapper. In the generated code, I am planning on attaching the flag to the options passed into the BaseService constructor.

If there is a problem during compression, the code moves alone with the request, just uncompressed. If this is not the behavior we want, I can change it.

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple things that need to be addressed, plus we should also support enabling gzip compression via an external config property... e.g. MYSERVICE_ENABLE_GZIP=true.

lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
@dpopp07
Copy link
Member Author

dpopp07 commented Oct 5, 2020

All feedback should now be addressed

@dpopp07 dpopp07 requested a review from padamstx October 5, 2020 22:20
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I mis-read something, I think there's an issue with the handling of the <service>_ENABLE_GZIP config property. And I had one other comment re: checking the Content-Encoding header as part of the successful tests.

lib/base-service.ts Show resolved Hide resolved
test/unit/request-wrapper.test.js Show resolved Hide resolved
a flag can be passed to the BaseService that will enable gzip compression on the request body data
Copy link
Contributor

@jorge-ibm jorge-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Looks like Phil covered the concerns I had.

@dpopp07 dpopp07 requested a review from padamstx October 6, 2020 15:54
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@dpopp07 dpopp07 merged commit 7692d71 into master Oct 6, 2020
@dpopp07 dpopp07 deleted the dp/gzip-requests branch October 6, 2020 16:45
ibm-devx-automation pushed a commit that referenced this pull request Oct 6, 2020
# [2.7.0](v2.6.0...v2.7.0) (2020-10-06)

### Features

* add support for compressing request bodies ([#111](#111)) ([7692d71](7692d71))
@ibm-devx-automation
Copy link

🎉 This PR is included in version 2.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants