Repository navigation
fix: extend Node.js IncomingHttpHeaders in our Headers type - #346
Merged
Merged
Conversation
Fixes: cloudevents#340 Signed-off-by: Lance Ball <lball@redhat.com>
aldirrix
reviewed
Oct 2, 2020
| */ | ||
| function getMode(headers: Headers): Mode { | ||
| const contentType = headers[CONSTANTS.HEADER_CONTENT_TYPE]; | ||
| const contentType = headers[CONSTANTS.HEADER_CONTENT_TYPE] as string; |
There was a problem hiding this comment.
i think you can add as const to the actual constants file instead of in every usage of this.
Ref: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions
in sdk-javascript/src/constants.ts
const CONSTANTS = Object.freeze({
CHARSET_DEFAULT: "utf-8",
...
} as const);
export default CONSTANTS;| }).to.throw; | ||
| }); | ||
|
|
||
| it("Can be created with Node's IncomingHttpHeaders", () => { |
| // set headers | ||
| for (const key of Object.getOwnPropertyNames(message.headers)) { | ||
| post.set(key, message.headers[key]); | ||
| post.set(key, message.headers[key] as string); |
There was a problem hiding this comment.
i guess we also have to submit an issue to superagent 😂
lholmquist
approved these changes
Oct 5, 2020
Signed-off-by: Lance Ball <lball@redhat.com>
Merged
This was referenced Dec 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
IncomingHttpHeadersin ourHeaderstypeDescription
Changes the
Headerstype to make it more compatible with Node.js TypeScript projects.Signed-off-by: Lance Ball lball@redhat.com