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

Header generation refactoring #2436

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
24a2b13
version 4
ATorrise Jan 31, 2025
dd36286
functional
ATorrise Feb 11, 2025
d2b8137
cleaning up and organizing
ATorrise Feb 11, 2025
0f0a03c
removing updatedOptions since headerMap removed binary, encoding ect …
ATorrise Feb 11, 2025
3845988
adding more context so proper uss and zfs specific headers accross sd…
ATorrise Feb 11, 2025
3e2bd3b
working minus download. more logic changes needed again
ATorrise Feb 12, 2025
ec3c719
about to clean things up but working and functional and every file am…
ATorrise Feb 14, 2025
091d609
completed
ATorrise Feb 14, 2025
4035c90
Merge remote-tracking branch 'origin/master' into rto4
ATorrise Feb 14, 2025
5291b1a
merging in changes
ATorrise Feb 14, 2025
0ebf5e2
small fixes
ATorrise Feb 14, 2025
e6c8c3f
changelog
ATorrise Feb 14, 2025
6f14d3c
changelog
ATorrise Feb 14, 2025
f0a7ea7
semicolon
ATorrise Feb 15, 2025
f747a4e
changelog fix
ATorrise Feb 15, 2025
ad22c4d
Merge branch 'rto4' of https://github.com/zowe/zowe-cli into rto4
ATorrise Feb 15, 2025
2e4809c
removing second refactor from this pr into its own
ATorrise Feb 18, 2025
3187daa
polishing
ATorrise Feb 18, 2025
0fc3b42
adding deprecation comment to old, limited method for header generation
ATorrise Feb 18, 2025
c243789
modifying create unit test to pass
ATorrise Feb 18, 2025
3bdab0c
minor change to pass test?
ATorrise Feb 18, 2025
33c8403
fixed typing so that test would pass
ATorrise Feb 19, 2025
d410d31
Merge remote-tracking branch 'origin/master' into rto4
ATorrise Feb 19, 2025
8d9c6c0
making changelog fixes per ana's suggestions
ATorrise Feb 19, 2025
9dbce9f
making changelog fixes per ana's suggestions
ATorrise Feb 19, 2025
c62d3f7
Merge branch 'master' into rto4
ATorrise Feb 19, 2025
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
4 changes: 4 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes

- Enhancement: Created a centralized header class with `packages/zosfiles/src/utils/ZosFilesHeaders.ts` to be used across all methods in the ZosFiles SDK. [#2436](https://github.com/zowe/zowe-cli/pull/2436)

## `8.13.0`

- Enhancement: Added the `--data-set-type` flag to create sequential data set command to allow for creating extended and large formatted sequential data sets. [#2141](https://github.com/zowe/zowe-cli/issues/2141)
Expand Down
4 changes: 4 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Zowe core SDK package will be documented in this file.

## Recent Changes

- Enhancement: Added the recursive header option, `X_IBM_RECURSIVE`, to `packages/core/src/rest/ZosmfHeaders.ts`. [#2436](https://github.com/zowe/zowe-cli/pull/2436)

## `8.1.1`

- BugFix: Updated peer dependencies to `^8.0.0`, dropping support for versions tagged `next`. [#2287](https://github.com/zowe/zowe-cli/pull/2287)
Expand Down
11 changes: 10 additions & 1 deletion packages/core/src/rest/ZosmfHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export class ZosmfHeaders {
public static readonly X_IBM_INTRDR_LRECL = "X-IBM-Intrdr-Lrecl";


/**
* header indicating recursive = true
* @static
* @memberof ZosmfHeaders
*/
public static readonly X_IBM_RECURSIVE = {"X-IBM-Option": "recursive"};

/**
* recfm header
* @static
Expand Down Expand Up @@ -115,7 +122,7 @@ export class ZosmfHeaders {
* @static
* @memberof ZosmfHeaders
*/
public static readonly X_CSRF_ZOSMF_HEADER: object = { "X-CSRF-ZOSMF-HEADER": true }; // "the value does not matter"
public static readonly X_CSRF_ZOSMF_HEADER: object = { "X-CSRF-ZOSMF-HEADER": "true" }; // "the value does not matter"

/**
* binary transfer header
Expand Down Expand Up @@ -166,6 +173,8 @@ export class ZosmfHeaders {
*/
public static readonly TEXT_PLAIN: IHeaderContent = { "Content-Type": "text/plain" };

public static readonly APPLICATION_JSON: IHeaderContent = { "Content-Type": "application/json" };

/**
* This header value specifies the maximum number of items to return.
* To request that all items be returned, set this header to 0. If you omit this header, or specify an incorrect value,
Expand Down
4 changes: 4 additions & 0 deletions packages/zosfiles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Zowe z/OS files SDK package will be documented in this file.

## Recent Changes

- Enhancement: Created a centralized header class with `packages/zosfiles/src/utils/ZosFilesHeaders.ts` to be used across all methods in the ZosFiles SDK. [#2436](https://github.com/zowe/zowe-cli/pull/2436)

## `8.13.0`

- BugFix: The `Create.dataSetValidateOptions()` function now correctly handles data set creation when the `dsorg` attribute is set to `PS-L` by automatically updating the `dsntype` attribute to `LARGE`. [#2141](https://github.com/zowe/zowe-cli/issues/2141)
Expand Down
20 changes: 10 additions & 10 deletions packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
Copy link
Member

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.

expectedPayload
);
});
Expand Down Expand Up @@ -123,7 +123,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -163,7 +163,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -203,7 +203,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -242,7 +242,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -281,7 +281,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -321,7 +321,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -361,7 +361,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -585,7 +585,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
});
Expand Down Expand Up @@ -673,7 +673,7 @@ describe("Copy", () => {
expect(copyExpectStringSpy).toHaveBeenLastCalledWith(
dummySession,
expectedEndpoint,
expectedHeaders,
expect.arrayContaining(expectedHeaders),
expectedPayload
);
expect(error.message).toContain(errorMessage);
Expand Down
Loading
Loading