How does node.js send a get request with a request header?

http.get("url",function(res){
        
       var html = ""
        
       res.on("data",function(chunk){
              html += chunk
       })
       
       res.on("end",function(){
              console.log(html)
       })
       
})



//
const options = {
     url:"xxxx"
     a:"asdsaf",
     fsa:"asioduioasd"
}
http.get(options,function(res){
...
})

I want to send a request with a specific request header to the url address. Excuse me, how can I set the request header in this?


Please see document :

set headers object in options

< hr >
const options = {
     url:'xxxx'
     headers:{
         a:'asdsaf',
         fsa:'asioduioasd'
     }
}
< hr >

clipboard.png

clipboard.png


const options = {
    hostname: 'xxx', 
    port: xx, 
    path: xxx, 
    method: 'GET',
    headers:{
         a:'asdsaf',
         fsa:'asioduioasd'
     }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3481f-2bf24.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3481f-2bf24.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?