Пример #1
0
  it('should not throw when using fetch without options', function(done) {
    const tracer = createNoopTracer();
    const fetch = wrapFetch(nodeFetch, {serviceName: 'user-service', tracer});

    const path = `http://127.0.0.1:${this.port}/user`;
    fetch(path)
      .then(res => res.json())
      .then(() => {
        done();
      })
      .catch(done);
  });
  it('should inject Zipkin headers into request', function() {
    var requestStore
    Vue.http.interceptors.push(function(request, next) {
      requestStore = request
      next(request.respondWith('', { status: 204, statusText: 'No Content' }))
    })
    const tracer = createNoopTracer()
    const interceptor = zipkinInterceptor({tracer, serviceName, remoteServiceName})

    Vue.http.interceptors.push(interceptor)

    const req = Vue.http.get('http://foo.bar/baz')

    return req.then(function(response) {
      assert.ok(requestStore.headers.get('X-B3-TraceId').length > 1)
      assert.ok(requestStore.headers.get('X-B3-SpanId').length > 1)
      assert.equal(requestStore.headers.get('X-B3-Sampled'), '1')
    })
  })