简体   繁体   中英

set header with http.get request javascript

hello I want to set the header of this exact http example

    var http = require('http');
    var request = http.get($scope.getUrl(item), function (response) {
        //something here
     };

tried it like this :

response.headers = "Range: bytes=0 - 10";

it didn't work as I want

Try using the setHeader method. like this:

  var http = require('http');
    var request = http.get($scope.getUrl(item), function (response) {
        response.setHeader("Range", "bytes=0 - 10");
     };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM