Welcome to mirror list, hosted at ThFree Co, Russian Federation.

referer.js « tap « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c1b173d9765969a8010df5fafbbf9f574dd8242d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var common = require("../common-tap.js")
var test = require("tap").test
var http = require("http")

test("should send referer http header", function (t) {
  http.createServer(function (q, s) {
    t.equal(q.headers.referer, "install foo")
    s.statusCode = 404
    s.end(JSON.stringify({error: "whatever"}))
    this.close()
  }).listen(common.port, function () {
    var reg = "http://localhost:" + common.port
    var args = [ "install", "foo", "--registry", reg ]
    common.npm(args, {}, function (er, code) {
      if (er) {
        throw er
      }
      // should not have ended nicely, since we returned an error
      t.ok(code)
      t.end()
    })
  })
})