File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,18 @@ class ProxyService {
6565 }
6666
6767 async coingecko ( targetUrl , method , headers , body ) {
68+ const _headers = {
69+ ...headers ,
70+ } ;
71+ if ( process . env . COINGECKO_KEY_TYPE === "pro" ) {
72+ _headers [ "x_cg_pro_api_key" ] = process . env . COINGECKO_API_KEY ;
73+ } else {
74+ _headers [ "x-cg-demo-api-key" ] = process . env . COINGECKO_API_KEY ;
75+ }
6876 const response = await axios ( {
6977 method,
7078 url : targetUrl ,
71- headers : {
72- ...headers ,
73- "x-cg-demo-api-key" : process . env . COINGECKO_API_KEY ,
74- } ,
79+ headers : _headers ,
7580 data : body ,
7681 } ) ;
7782 return {
@@ -151,7 +156,7 @@ class ProxyService {
151156 status : error . response . status ,
152157 headers : error . response . headers ,
153158 data : error . response . data ,
154- } ;
159+ } ;
155160 }
156161 }
157162
You can’t perform that action at this time.
0 commit comments