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

[PDE-4118] fix(core): Use node-fetch types in BaseHttpResponse #736

Merged
merged 7 commits into from
Jan 30, 2024

Conversation

rnegron
Copy link
Member

@rnegron rnegron commented Jan 29, 2024

Fixes #667. As noted in the bug report, using .headers.get() returns a TypeScript error TS2349: This expression is not callable. Type 'String' has no call signatures.:

Screenshot 2024-01-29 at 1 06 39 PM

But testing it out (using vanilla JavaScript) shows that .headers.get() does work (first console.log is response.headers['content-type'], second is response.headers.get('content-type'):

console.log
  undefined

  at perform (lib/creates/movie.js:15:13)

console.log
  application/json; charset=utf-8

  at perform (lib/creates/movie.js:16:13)

@rnegron rnegron requested a review from kreddlear January 29, 2024 17:09
@rnegron rnegron requested a review from eliangcs as a code owner January 29, 2024 17:09
kreddlear
kreddlear previously approved these changes Jan 29, 2024
Copy link
Member

@eliangcs eliangcs 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!

I didn't know @types/node-fetch exist. I wonder if we could just replace a lot of things, like HttpRequestOptions, BaseHttpResponse, and RawHttpResponse with node-fetch's.

@rnegron
Copy link
Member Author

rnegron commented Jan 30, 2024

@eliangcs I looked at replacing some of the other custom types with node-fetch equivalents but there were some subtle differences between them, such as custom methods (like throwForStatus) and properties (like removeMissingValuesFrom).

@rnegron rnegron merged commit add8362 into main Jan 30, 2024
13 checks passed
@rnegron rnegron deleted the PDE-4118 branch January 30, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: BaseHttpResponse.headers incorrectly typed
3 participants