4

I'm aware that I can add a header to a D3 JSON request by doing the following:

d3.json("http://localhost:8080/data")
  .header("Application-ID", "1")

But how do I add this header when using queue's defer?

queue()
  .defer(d3.json, "http://localhost:8080/data")

1 Answers1

6

d3.json doesn't actually perform the request until you call get. So, if your goal is to make a deferred http request, you can just do:

var req = d3.json("http://localhost:8080/data")
    .header("Application-ID", "1");
queue().defer(req.get);
Jamie
  • 2,181
  • 1
  • 21
  • 35