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

response.headers is not iterable error #445

Open
yaronya opened this issue Nov 28, 2021 · 1 comment
Open

response.headers is not iterable error #445

yaronya opened this issue Nov 28, 2021 · 1 comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects

Comments

@yaronya
Copy link

yaronya commented Nov 28, 2021

Hi,

I'm using @octokit/rest as my GH rest client and I found a possible bug in

for (const keyAndValue of response.headers) {
where I use a fetch wrapper that return headers as a non-iterable object. In that case, @octokit/request throws an error saying response.headers is not iterable.

I'd expect the package to iterate the headers attribute only if it exists and is iterable...

@ghost ghost added this to Inbox in JS Nov 28, 2021
@wolfy1339 wolfy1339 added the Type: Bug Something isn't working as documented label Jul 14, 2022
@ghost ghost moved this from Inbox to Bugs in JS Jul 14, 2022
@wolfy1339 wolfy1339 added Priority: Normal Status: Up for grabs Issues that are ready to be worked on by anyone labels May 21, 2023
@nickfloyd nickfloyd added the hacktoberfest Issues for participation in Hacktoberfest label Sep 20, 2023
@wolfy1339
Copy link
Member

We switched to using the fetch API, which means that response.headers is a Headers instance, which is iterable.
That whole for loop can be simplified to use a simple Object.fromEntries()

Can you describe what the response.headers looks like for you? Is it a simple object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
Status: 🔥 Backlog
JS
  
Bugs
Development

No branches or pull requests

3 participants