Last active
          February 22, 2023 16:59 
        
      - 
      
- 
        Save alexewerlof/fedfe80d59aa1c096267600595ba423e to your computer and use it in GitHub Desktop. 
    converting fetch response headers to a plain javascript object
  
        
  
    
      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
    
  
  
    
  | const fetch = require('node-fetch') | |
| const am = require('am') | |
| async function main() { | |
| const url = 'https://www.example.com' | |
| const response = await fetch(url) | |
| const responseHeaders = Object.fromEntries(resp.headers.entries()) | |
| console.dir(responseHeaders) | |
| return responseHeaders | |
| } | |
| am(main) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
There is typo on line 2 (
comst).https://gist.github.com/userpixel/fedfe80d59aa1c096267600595ba423e#file-fetch-response-header-js-L2