From cda40d2cb1c6d125ca9f1fa1505a8507bb1381c2 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Thu, 6 Aug 2020 16:39:08 +0200 Subject: [PATCH] Use the X-Request-ID request header when request_id present --- lib/carto/named_maps/api.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/carto/named_maps/api.rb b/lib/carto/named_maps/api.rb index 2cb4de6a0c..e79c59926d 100644 --- a/lib/carto/named_maps/api.rb +++ b/lib/carto/named_maps/api.rb @@ -129,6 +129,8 @@ module Carto 'content-type': 'application/json', 'host': domain(username) } + headers = request_id ? @headers.merge('X-Request-ID': request_id) : @headers + headers end def domain(username) @@ -139,6 +141,10 @@ module Carto CartoDB.subdomainless_urls? ? config_domain : "#{username}.#{config_domain}" end + def request_id + Carto::CurrentRequest.request_id + end + def port @port ||= Cartodb.get_config(:tiler, 'internal', 'port') end