-
Notifications
You must be signed in to change notification settings - Fork 87
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
Header generation refactoring #2436
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
…and there's no more duplication possible Signed-off-by: Amber <[email protected]>
…k methods Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
…mended that needs to be Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
📅 Suggested merge-by date: 3/5/2025 |
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2436 +/- ##
==========================================
- Coverage 91.49% 91.45% -0.05%
==========================================
Files 641 642 +1
Lines 18358 18341 -17
Branches 3978 3955 -23
==========================================
- Hits 16796 16773 -23
- Misses 1560 1566 +6
Partials 2 2 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Amber Torrise <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments re: changelogs
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
Signed-off-by: Amber <[email protected]>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I attempted to run a zowe files list ds
command on this branch, but it fails with the following error:
Response From Service
TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "undefined"
@@ -84,7 +84,7 @@ describe("Copy", () => { | |||
expect(copyExpectStringSpy).toHaveBeenLastCalledWith( | |||
dummySession, | |||
expectedEndpoint, | |||
expectedHeaders, | |||
expect.arrayContaining(expectedHeaders), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to make sure that no extra headers are being defined, so I don't think we should use expect.arrayContaining
for headers in our unit tests.
If we need a way to ignore the order of the headers, we could create a Jest helper function that expects the exact same set of items but allows any order.
This refactoring effort centralizes and standardizes header generation across the SDK and CLI.
responseTimeout
(and other headers) are now consistently applied in all REST calls and to simplify maintenance and future extensibility.All header logic is now consolidated in a single utility class in
ZosFilesHeaders.
This replaces duplicate header creation logic across multiple SDK methods and separate header generation functions across the different methods.Header Generation now:
options
dataLength
context
where:STREAM
andBUFFER
: representing any upload/download operationUSS
ZFS
Undefined
/Default
: when no context is provided, the default is to treat the operation as a Dataset creation.Because of this centralization, any future header changes or additions require modifications in only one location. And creating headers can now be done with a one line function call, without much thought required in future development of the files SDK.